Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.5.0a4

Request #9700 Incorrect timestamps allowd
Submitted: 2006-12-26 16:30 UTC Modified: 2008-03-23 19:05 UTC
From: seb dot anselment at gmx dot de Assigned: c01234
Status: Closed Package: Date (version 1.4.7)
PHP Version: 4.3.10 OS: Debian
Roadmaps: (Not assigned)    
Subscription  


 [2006-12-26 16:30 UTC] seb dot anselment at gmx dot de (S├ębastien Anselment)
Description: ------------ Hi, I really love this package but I found a very strange behavior when passing a not existing timestamp like f.ex. 20060132T163315 (month is 32) to the Date constructor. Surely this makes no sense but it's so easy to set a correct date (like mktime does). You can see the test script beyond these lines. I found nothing in one of the 88 reports matching this topic. Now decide yourselves if this is a bug report or feature request ;) I wish you all a merry Christmas and a happy new year! Continue your great work. Yours, Seb Test script: --------------- $timestamp = "20060132T163315"; $d = new Date($timestamp); echo $d->getDate(DATE_FORMAT_ISO_BASIC); //I solved this by using: $timestamp = "20060132T163315"; $d = new Date($timestamp); $d->addSpan(new Date_Span("0,0,0,0")); echo $d->getDate(DATE_FORMAT_ISO_BASIC); Expected result: ---------------- 2006-02-01 16:33:15 Actual result: -------------- 2006-01-32 16:33:15

Comments

 [2006-12-26 20:31 UTC] firman (Firman Wandayandi)
Yep, you are right. Since setDate() allowed any timestamp, not only date, but also time too. Currently, we are working at 1.5.x branch, Date would be more strict/smart also faster. Hope will finish it soon. You too, have a great holiday. Thanks :)
 [2007-11-05 20:09 UTC] c01234 (Chuckie Chuck)
This has been changed in CVS
 [2008-03-23 19:05 UTC] c01234 (Chuckie Chuck)
Thank you for your bug report. This issue has been fixed in the latest released version of the package, which you can download at http://pear.php.net/get/Date