#21324 [Opn->Csd]: Date's convertTZbyID() is buggy
| From: | mj@php.net | Date: | Fri, 03 Jan 2003 12:00:55 +0000 |
| Subject: | #21324 [Opn->Csd]: Date's convertTZbyID() is buggy | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-12058@lists.php.net to get a copy of this message | ||
ID: 21324
Updated by: mj@php.net
Reported By: ross@netebb.com
-Status: Open
+Status: Closed
Bug Type: PEAR related
Operating System: any
PHP Version: 4CVS-2003-01-01 (dev)
New Comment:
This bug has been fixed in CVS and the changes will appear in the next
release of PEAR::Date.
Previous Comments:
------------------------------------------------------------------------
[2003-01-01 20:46:28] ross@netebb.com
require_once 'Date/Date.php';
$date = new Date(time());
echo $date->format('%A %e of %B, %Y [%R %Z]'),"\n";
$date->convertTZbyID('US/Eastern');
echo $date->format('%A %e of %B, %Y [%R %Z]'),"\n";
produces:
Wednesday 1 of January, 2003 [18:39 PST]
Wednesday 01 of , 2003 [21:39 EST]
This patch will fix it:
Index: Date.php
===================================================================
RCS file: /repository/pear/Date/Date.php,v
retrieving revision 1.7
diff -u -r1.7 Date.php
--- Date.php 12 Nov 2002 18:11:10 -0000 1.7
+++ Date.php 2 Jan 2003 02:41:32 -0000
@@ -532,6 +532,9 @@
list($this->year, $this->month, $this->day) =
sscanf(Date_Calc::daysToDate($d), "%04s%02s%02s");
+ $this->year = intval($this->year);
+ $this->month = intval($this->month);
+ $this->day = intval($this->day);
}
/**
@@ -580,6 +583,9 @@
list($this->year, $this->month, $this->day) =
sscanf(Date_Calc::daysToDate($d), "%04s%02s%02s");
+ $this->year = intval($this->year);
+ $this->month = intval($this->month);
+ $this->day = intval($this->day);
}
/**
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=21324&edit=1