diff --git a/_test/cases/inc/IXR_Library_date.test.php b/_test/cases/inc/IXR_Library_date.test.php
new file mode 100644
index 0000000000000000000000000000000000000000..a2b6154d8f00ee516259148b3edca8397bd1179c
--- /dev/null
+++ b/_test/cases/inc/IXR_Library_date.test.php
@@ -0,0 +1,34 @@
+<?php
+require_once DOKU_INC.'inc/IXR_Library.php';
+
+class ixr_library_date_test extends UnitTestCase {
+
+
+    function test_parseIso(){
+        // multiple tests
+        $tests = array(
+            // full datetime, different formats
+            array('2010-08-17T09:23:14',  1282036994),
+            array('20100817T09:23:14',    1282036994),
+            array('2010-08-17 09:23:14',  1282036994),
+            array('20100817 09:23:14',    1282036994),
+            array('2010-08-17T09:23:14Z', 1282036994),
+            array('20100817T09:23:14Z',   1282036994),
+
+            // no seconds
+            array('2010-08-17T09:23',     1282036980),
+            array('20100817T09:23',       1282036980),
+
+            // no time
+            array('2010-08-17',           1282003200),
+            //array('20100817',             1282003200), #this will NOT be parsed, but is assumed to be timestamp
+        );
+
+        foreach($tests as $test){
+            $dt = new IXR_Date($test[0]);
+            $this->assertEqual($dt->getTimeStamp(),$test[1]);
+        }
+    }
+
+}
+//Setup VIM: ex: et ts=4 enc=utf-8 :
diff --git a/inc/IXR_Library.php b/inc/IXR_Library.php
index b82952d743f92d6a33e2533ea6ea093c87b24d76..2fb7dfe689d75bdff5bf374140851a46c6231c47 100644
--- a/inc/IXR_Library.php
+++ b/inc/IXR_Library.php
@@ -615,12 +615,14 @@ class IXR_Date {
         $this->second = gmdate('s', $timestamp);
     }
     function parseIso($iso) {
-        $this->year = substr($iso, 0, 4);
-        $this->month = substr($iso, 5, 2);
-        $this->day = substr($iso, 8, 2);
-        $this->hour = substr($iso, 11, 2);
-        $this->minute = substr($iso, 14, 2);
-        $this->second = substr($iso, 17, 2);
+        if(preg_match('/^(\d\d\d\d)-?(\d\d)-?(\d\d)([T ](\d\d):(\d\d)(:(\d\d))?)?/',$iso,$match)){
+            $this->year   = (int) $match[1];
+            $this->month  = (int) $match[2];
+            $this->day    = (int) $match[3];
+            $this->hour   = (int) $match[5];
+            $this->minute = (int) $match[6];
+            $this->second = (int) $match[8];
+        }
     }
     function getIso() {
         return $this->year.$this->month.$this->day.'T'.$this->hour.':'.$this->minute.':'.$this->second;