[dokuwiki] Bug IXR_Date::parseIso($iso) works incorrect

Hi.

    Simple example:

    global $conf;
    require_once(DOKU_INC.'inc/IXR_Library.php');
    $now = time();
    $date = new IXR_Date($now);
    $ndate = new IXR_Date($date->getIso());
   
    print $date->getIso()." != ".$ndate->getIso();

    result like this:
"2009-03-11T07:56:18 != 2009--0-3-T1T:7::6:"
  

    Attached patch solves problem.

--- dokuwiki-latest/inc/IXR_Library.php~        2009-03-04 01:10:04.000000000 
+0400
+++ dokuwiki-latest/inc/IXR_Library.php 2009-03-11 11:37:25.000000000 +0400
@@ -615,11 +615,11 @@
     }
     function parseIso($iso) {
         $this->year = substr($iso, 0, 4);
-        $this->month = substr($iso, 4, 2);
-        $this->day = substr($iso, 6, 2);
-        $this->hour = substr($iso, 9, 2);
-        $this->minute = substr($iso, 12, 2);
-        $this->second = substr($iso, 15, 2);
+        $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);
     }
     function getIso() {
         return 
$this->year.'-'.$this->month.'-'.$this->day.'T'.$this->hour.':'.$this->minute.':'.$this->second;

Other related posts:

  • » [dokuwiki] Bug IXR_Date::parseIso($iso) works incorrect - Mikhail I. Izmestev