|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-09-13 20:54 UTC] salathe@php.net
-Assigned To:
+Assigned To: derick
[2012-02-20 21:51 UTC] john at gbd dot co dot uk
[2017-01-17 06:35 UTC] heiglandreas@php.net
-Status: Assigned
+Status: Wont fix
[2017-01-17 06:35 UTC] heiglandreas@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 01:00:01 2025 UTC |
Description: ------------ Some dates falling on February 29th in negative years can not have an interval of one day added to them. The pattern appears to be years of the form -n16, but some years behave as expected (e.g. -816 and -416 in the test script below). Test script: --------------- <?php for ($i = -1000; $i < 1000; $i++) { $date = new DateTime('midnight', new DateTimeZone('UTC')); $date->setDate($i, 2, 29); // Rolled over into March, no Feb 29th, skip if ($date->format('M') !== 'Feb') { continue; } $next = clone $date; $next->add(new DateInterval('P1D')); if ($date->format('Y-m-d') === $next->format('Y-m-d')) { echo $next->format('Y-m-d l') . PHP_EOL; } } ?> Expected result: ---------------- No output is expected. Actual result: -------------- -0916-02-29 Friday -0716-02-29 Tuesday -0616-02-29 Sunday -0516-02-29 Friday -0316-02-29 Tuesday -0216-02-29 Sunday -0116-02-29 Friday