[php-src] Issue #8432: Incorrect DST Calculation in Intl

From: Date: Sat, 23 Apr 2022 20:35:41 +0000
Subject: [php-src] Issue #8432: Incorrect DST Calculation in Intl
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-241201@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/8432 Author: jimbo2150 ### Description The following code: ```php <?php date_default_timezone_set('America/New_York'); $cal = new IntlGregorianCalendar(2022, 2, 12, 1, 59, 59); echo IntlDateFormatter::formatObject($cal), "\n"; $cal->add(IntlCalendar::FIELD_DAY_OF_MONTH, 1); echo IntlDateFormatter::formatObject($cal), "\n"; $cal->add(IntlCalendar::FIELD_SECOND, 1); echo IntlDateFormatter::formatObject($cal), "\n"; ``` Resulted in this output: ``` Mar 12, 2022, 1:59:59 AM Mar 13, 2022, 1:59:59 AM Mar 13, 2022, 3:00:00 AM ``` But I expected this output instead: ``` Mar 12, 2022, 1:59:59 AM Mar 13, 2022, 2:59:59 AM Mar 13, 2022, 3:00:00 AM ``` Daylight saving time (DST) is not taken into account when calculating non-time values in Intl calendar class. If I add a second, hour, or minute, the result ends up being correct - except in the above example where March 12 @ 2:00 is already passed by a day & adding 1 second to March 13 then adds the additional hour. But adding days, months, years fails to calculate the correct time when DST boundaries are crossed. ### PHP Version PHP 8.1.5 ### Operating System _No response_

« previous php.bugs (#241201) next »