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

From: Date: Sat, 23 Apr 2022 22:31:51 +0000
Subject: [php-src] Issue #8432: Incorrect DST Calculation in Intl
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-241207@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/8432 Comment Author: damianwadley > They both cross a DST boundary and seems like they should both account for it. That's a valid opinion, one that I think most human beings would _not_ consider themselves, but a lot of languages and libraries don't work that way. Because Dates Are Hard™️, and there is no single obvious solution to everything. Here, what libicu (which powers the intl extension) and actually also PHP (in the date extension) do is take the simplest approach: literally add. ``` Mar 13th 1:59am + 1 day ================= Mar 14th 1:59am ``` As long as the result makes sense* then there's nothing else that needs to be done. With hours it works like ``` Mar 13th 1:59am + 24 hours ================= Mar 13th 1:59am + 1 hour 2:59am -> 3:59am because of DST + 1 hour 4:59am + 1 hour 5:59am + ... ================= Mar 14th 2:59am ``` (* Mar 12th 2:00am + 1 day = Mar 13th 2:00am which doesn't make sense because of DST and so is "corrected" to 3:00am.)

« previous php.bugs (#241207) next »