Bug #63392 [Opn]: DateTime::modify() start of week inconsistency
| From: | pajoye@php.net | Date: | Sat, 24 Nov 2012 11:17:07 +0000 |
| Subject: | Bug #63392 [Opn]: DateTime::modify() start of week inconsistency | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-174886@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=63392&edit=1
ID: 63392
Updated by: pajoye@php.net
Reported by: chris at cmbuckley dot co dot uk
Summary: DateTime::modify() start of week inconsistency
Status: Open
Type: Bug
Package: Date/time related
PHP Version: 5.4Git-2012-10-30 (snap)
-Assigned To:
+Assigned To: derick
Block user comment: N
Private report: N
New Comment:
See also PR https://github.com/php/php-src/pull/224
Previous Comments:
------------------------------------------------------------------------
[2012-10-30 02:26:30] chris at cmbuckley dot co dot uk
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 this bug report at https://bugs.php.net/bug.php?id=63392&edit=1