Skip to content

Commit 8426623

Browse files
committed
Upgrade timelib to 2021.06
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).
1 parent f094ee2 commit 8426623

16 files changed

+412
-220
lines changed

NEWS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? ????, PHP 8.1.0beta3
44

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

613

714
05 Aug 2021, PHP 8.1.0beta2

ext/date/lib/interval.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ timelib_rel_time *timelib_diff(timelib_time *one, timelib_time *two)
9090
timelib_do_rel_normalize(rt->invert ? one : two, rt);
9191

9292
/* Do corrections for "Type 3" times */
93-
if (one->zone_type == 3 && two->zone_type == 3) {
93+
if (one->zone_type == 3 && two->zone_type == 3 && strcmp(one->tz_info->name, two->tz_info->name) == 0) {
9494
if (one->dst == 1 && two->dst == 0) { /* Fall Back */
9595
if (two->tz_info) {
9696
trans = timelib_get_time_zone_info(two->sse, two->tz_info);
@@ -130,7 +130,11 @@ timelib_rel_time *timelib_diff(timelib_time *one, timelib_time *two)
130130
}
131131
} else {
132132
/* Then for all the others */
133-
rt->h -= dst_h_corr + (two->dst - one->dst);
133+
if (one->zone_type == 3 && two->zone_type == 3) {
134+
rt->h -= dst_h_corr;
135+
} else {
136+
rt->h -= dst_h_corr + (two->dst - one->dst);
137+
}
134138
rt->i -= dst_m_corr;
135139

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

0 commit comments

Comments
 (0)