Skip to content

Commit

Permalink
Upgrade timelib to 2021.06
Browse files Browse the repository at this point in the history
Fixes among others:
. Bug #79580 (date_create_from_format misses leap year).
. Bug #80974 (Wrong diff between 2 dates in different timezones).
. Bug #81097 (DateTimeZone silently falls back to UTC when providing an offset with seconds).
. Bug #81273 (Date interval calculation not correct).
  • Loading branch information
derickr committed Aug 8, 2021
1 parent f094ee2 commit 8426623
Show file tree
Hide file tree
Showing 16 changed files with 412 additions and 220 deletions.
7 changes: 7 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 8.1.0beta3

- Date:
. Fixed bug #79580 (date_create_from_format misses leap year). (Derick)
. Fixed bug #80974 (Wrong diff between 2 dates in different timezones).
(Derick)
. Fixed bug #81097 (DateTimeZone silently falls back to UTC when providing an
offset with seconds). (Derick)
. Fixed bug #81273 (Date interval calculation not correct). (Derick)


05 Aug 2021, PHP 8.1.0beta2
Expand Down
8 changes: 6 additions & 2 deletions ext/date/lib/interval.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ timelib_rel_time *timelib_diff(timelib_time *one, timelib_time *two)
timelib_do_rel_normalize(rt->invert ? one : two, rt);

/* Do corrections for "Type 3" times */
if (one->zone_type == 3 && two->zone_type == 3) {
if (one->zone_type == 3 && two->zone_type == 3 && strcmp(one->tz_info->name, two->tz_info->name) == 0) {
if (one->dst == 1 && two->dst == 0) { /* Fall Back */
if (two->tz_info) {
trans = timelib_get_time_zone_info(two->sse, two->tz_info);
Expand Down Expand Up @@ -130,7 +130,11 @@ timelib_rel_time *timelib_diff(timelib_time *one, timelib_time *two)
}
} else {
/* Then for all the others */
rt->h -= dst_h_corr + (two->dst - one->dst);
if (one->zone_type == 3 && two->zone_type == 3) {
rt->h -= dst_h_corr;
} else {
rt->h -= dst_h_corr + (two->dst - one->dst);
}
rt->i -= dst_m_corr;

timelib_do_rel_normalize(rt->invert ? one : two, rt);
Expand Down

0 comments on commit 8426623

Please sign in to comment.