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

 ID:                 63927
 User updated by:    tcheko at no-log dot org
 Reported by:        tcheko at no-log dot org
 Summary:            Bogus week number with date + strtotime
 Status:             Not a bug
 Type:               Bug
 Package:            Date/time related
 Operating System:   Linux
 PHP Version:        5.4.10
 Block user comment: N
 Private report:     N

 New Comment:

Replace Y with o for expected year. 

Definitly subtle, misleading and brain damaged.

for($i = 15; $i >= 0; $i--) echo date("oW", strtotime("-$i week")) . "<br />";


Previous Comments:
------------------------------------------------------------------------
[2013-01-07 09:22:54] [email protected]

There is no bug here. This is correct as per the ISO-8601 Date spec. The first 
week of the year is the week that contains the first Thursday. And weeks always 
start on Mondays. That means the first day of the first week is not always in 
the 
same calendar year as the first Thursday. Please read the ISO-8601 spec for 
more 
details.

------------------------------------------------------------------------
[2013-01-07 09:06:49] tcheko at no-log dot org

Description:
------------
the test script returns date formated as year+week.

It should return a list of date like this:

...
201250
201251
201252
201301
201302
...

NB: increase $i if current weeknumber is greater than 14 to expose the bug.

Test script:
---------------
<?php
for($i = 15; $i >= 0; $i--) echo date("YW", strtotime("-$i week")) . "<br />";
?>


Expected result:
----------------
...
201250
201251
201252
201301
201302
...

Actual result:
--------------
...
201250
201251
201252
**201201**
201302
...




------------------------------------------------------------------------



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

Reply via email to