Edit report at https://bugs.php.net/bug.php?id=63392&edit=1

 ID:                 63392
 Updated by:         paj...@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

Reply via email to