- OS version and name: MacOS Sonoma 14.5
- Pendulum version: 3.0.0
Issue
There's a problem when comparing dates which are in the same timezone, but have different offsets due to daylight savings in the fold. Basically, daylight savings are not taken into account in the fold.
In the following example, d1 is after the fold, meaning it was 2:15 AM and was moved back to 1:15 AM, which should be after 1:25 AM before the fold.
However, simply comparing d1 to d2 with d1 < d2 returns True, whereas d1.timestamp() < d2.timestamp() returns the correct result, False.
Example:
d1 = pendulum.datetime(2023, 11, 5, 1, 15, 0, 0, tz="America/Los_Angeles", fold=1)
d2 = pendulum.datetime(2023, 11, 5, 1, 25, 0, 0, tz="America/Los_Angeles", fold=0)
print(d1 < d2) # True
print(d1.timestamp() < d2.timestamp()) # False
Issue
There's a problem when comparing dates which are in the same timezone, but have different offsets due to daylight savings in the fold. Basically, daylight savings are not taken into account in the fold.
In the following example, d1 is after the fold, meaning it was 2:15 AM and was moved back to 1:15 AM, which should be after 1:25 AM before the fold.
However, simply comparing d1 to d2 with
d1 < d2returnsTrue, whereasd1.timestamp() < d2.timestamp()returns the correct result,False.Example: