You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DateTime::diff doesnt evaluate daylight saving time correctly #9382
@cmb69@derickr forgot to add a note in the manual for diff, if they are with timezone type int 3 the result is effective otherwise if different timezones will be converted to UTC and calculate the difference. if you need I will send you when diff has been modified.
DateTime::Diff php 8.10 > if object same type offset timezone $origin and $target is local time object. Means for DST +0200: Europe/Berlin = Europe/Berlin or Europe/Berlin = +0200 or Europe/Berlin = CEST (ex. Localtime object 2022-03-27 02:00:00 - 2022-03-27 02:00:00 = 0 or 2022-03-27 03:00:00 - 2022-03-27 03:00:00 = 0 or Europe/Berlin = +0200 2022-03-27 03:00:00 - 2022-03-27 02:00:00 = 0), for Europe/Berlin: ST (+0100) and DST (+0200) 2022-03-27 01:00:00 - 2022-03-27 03:00:00 = 1 or 2022-03-27 01:00:00 - 2022-03-27 02:00:00 = 1
Note* for ST type 3 and DST type 1: besides the bug mentioned Diff does not support several transitions. In all other cases it converts it to UTC.
DateTime::Diff php 5.3.0 < php 8.1.0 $origin and $target is UTC object. Europe/Berlin to UTC. Means: (ex. UTC object 2022-03-27 01:00:00 - 2022-03-27 01:00:00 = 0)
This seems to be already fixed in the 8.1.10RC1. I can successfully recreate this with 8.1.9, but not with 8.1.10RC1. I believe it is a duplicate of #8730.
Activity
cmb69 commentedon Aug 19, 2022
Indeed, that looks wrong to me.
hormus commentedon Aug 20, 2022
@cmb69 @derickr forgot to add a note in the manual for diff, if they are with timezone type int 3 the result is effective otherwise if different timezones will be converted to UTC and calculate the difference. if you need I will send you when diff has been modified.
yes it's a bug for me too
Valid period transitions:
DateTime::Diff php 8.10 > if object same type offset timezone $origin and $target is local time object. Means for DST +0200: Europe/Berlin = Europe/Berlin or Europe/Berlin = +0200 or Europe/Berlin = CEST (ex. Localtime object 2022-03-27 02:00:00 - 2022-03-27 02:00:00 = 0 or 2022-03-27 03:00:00 - 2022-03-27 03:00:00 = 0 or Europe/Berlin = +0200 2022-03-27 03:00:00 - 2022-03-27 02:00:00 = 0), for Europe/Berlin: ST (+0100) and DST (+0200) 2022-03-27 01:00:00 - 2022-03-27 03:00:00 = 1 or 2022-03-27 01:00:00 - 2022-03-27 02:00:00 = 1
Note* for ST type 3 and DST type 1: besides the bug mentioned Diff does not support several transitions. In all other cases it converts it to UTC.
DateTime::Diff php 5.3.0 < php 8.1.0 $origin and $target is UTC object. Europe/Berlin to UTC. Means: (ex. UTC object 2022-03-27 01:00:00 - 2022-03-27 01:00:00 = 0)
derickr commentedon Aug 25, 2022
This seems to be already fixed in the 8.1.10RC1. I can successfully recreate this with 8.1.9, but not with 8.1.10RC1. I believe it is a duplicate of #8730.
chaosben commentedon Aug 25, 2022
🥳 Thanks!