Doc #55799 [NEW]: DateTime::setISODate allows weeks to overflow in the next year
| From: | paul dot borgermans at gmail dot com | Date: | Tue, 27 Sep 2011 13:01:04 +0000 |
| Subject: | Doc #55799 [NEW]: DateTime::setISODate allows weeks to overflow in the next year | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-7268@lists.php.net to get a copy of this message | ||
From:
Operating system: Ubuntu / Mac OSX
PHP version: 5.3.8
Package: Date/time related
Bug Type: Documentation Problem
Bug description:DateTime::setISODate allows weeks to overflow in the next year
Description:
------------
This is actually a nice feature for calender data/time operations, but not
documented yet:
Specifying a week number larger than valid for the year, the end results
nicely overflows into the next year.
Test script:
---------------
<?php
echo date( âWâ, strtotime( "December 28th, 2011" ) ), "\n";
$ndate = new DateTime();
$ndate->setISODate(2011,56,07);
echo "ndate: " . $ndate->format('Y-m-d') . "\n";
$ndate->setISODate(2012,04,07);
echo "ndate: " . $ndate->format('Y-m-d') . "\n";
?>
Expected result:
----------------
52
ndate: 2012-01-29
ndate: 2012-01-29
Actual result:
--------------
52
ndate: 2012-01-29
ndate: 2012-01-29
--
Edit bug report at https://bugs.php.net/bug.php?id=55799&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=55799&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=55799&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=55799&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=55799&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=55799&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=55799&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=55799&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=55799&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=55799&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=55799&r=support
Expected behavior: https://bugs.php.net/fix.php?id=55799&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=55799&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=55799&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=55799&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=55799&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=55799&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=55799&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=55799&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=55799&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=55799&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=55799&r=mysqlcfg