Bug #79396 [PATCH]: DateTime hour incorrect during DST jump forward using setTime
| From: | n@tebru.net | Date: | Wed, 18 Mar 2020 20:12:44 +0000 |
| Subject: | Bug #79396 [PATCH]: DateTime hour incorrect during DST jump forward using setTime | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-226170@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79396&edit=1
ID: 79396
Patch added by: n@tebru.net
Reported by: n at tebru dot net
Summary: DateTime hour incorrect during DST jump forward
using setTime
Status: Open
Type: Bug
Package: Date/time related
Operating System: MacOS
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
The following pull request has been associated:
Patch Name: Fixing issue with setTime during DST jump
On GitHub: https://github.com/php/php-src/pull/5276
Patch: https://github.com/php/php-src/pull/5276.patch
Previous Comments:
------------------------------------------------------------------------
[2020-03-18 20:01:27] n at tebru dot net
Description:
------------
When using DateTime::setTime() and setting the time to a time that doesn't exist (during a DST
jump forward), the timestamp is correct, but the hour does not move forward.
Test script:
---------------
$tz = new DateTimeZone('America/Chicago');
$date = new DateTime('2020-03-08 01:00:00', $tz);
$date->setTime(2,0);
var_dump($date->format(DateTime::ATOM));
Expected result:
----------------
string(25) "2020-03-08T03:00:00-05:00"
Actual result:
--------------
string(25) "2020-03-08T02:00:00-05:00"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79396&edit=1