Bug #63392 [NEW]: DateTime::modify() start of week inconsistency

From: Date: Tue, 30 Oct 2012 02:26:30 +0000
Subject: Bug #63392 [NEW]: DateTime::modify() start of week inconsistency
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-174413@lists.php.net to get a copy of this message
From: chris at cmbuckley dot co dot uk Operating system: PHP version: 5.4Git-2012-10-30 (snap) Package: Date/time related Bug Type: Bug Bug description:DateTime::modify() start of week inconsistency Description: ------------ Calling $dt->modify("Monday this week") for all dates 13–19 May 2012 (Sun–Sat) result in the same date (2012-05-14), suggesting that "this week" runs Sun–Sat. However, calling $dt->modify("Sunday this week") gives the "next" Sunday (2012- 05-20) for the same range. On a related note, the documentation on relative date formats is lacking on the behaviour of this and strtotime when used with locales; one might expect the start of the week to be interpreted from LC_TIME. Test script: --------------- <?php $dt = new DateTime("2012-05-13"); $dt->modify("Sunday this week"); var_dump($dt->format('r')); Expected result: ---------------- string(31) "Sun, 13 May 2012 00:00:00 +0000" Actual result: -------------- string(31) "Sun, 20 May 2012 00:00:00 +0000" -- Edit bug report at https://bugs.php.net/bug.php?id=63392&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=63392&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=63392&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=63392&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=63392&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=63392&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=63392&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=63392&r=needscript Try newer version: https://bugs.php.net/fix.php?id=63392&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=63392&r=support Expected behavior: https://bugs.php.net/fix.php?id=63392&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=63392&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=63392&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=63392&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63392&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=63392&r=dst IIS Stability: https://bugs.php.net/fix.php?id=63392&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=63392&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=63392&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=63392&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=63392&r=mysqlcfg

« previous php.bugs (#174413) next »