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
I have searched the issues of this repo and believe that this is not a duplicate.
OS version and name: Windows 11
Pendulum version: 3.0.0
Issue
The fold attribute behaves weirdly when adding different timedeltas to a datetime object. Adding minutes changes the fold from 0 to 1. Adding days keeps it at 1.
On the other hand, when setting fold to 0, adding minutes preserves it, and adding days changes it.
It seems like adding minutes forces the fold attribute to be 0 and days forces it to be 1.
When working with pendulum and dst, I ran into this issue:
str(pendulum.parse("2024-10-27 02:00:00", tz="Europe/Copenhagen"))
'2024-10-27 02:00:00+01:00'
str(pendulum.parse("2024-10-27 02:00:00", tz="Europe/Copenhagen").subtract(minutes=15))
'2024-10-27 02:45:00+02:00' <-- Why does this end as 02:00 ?
If "2024-10-27 02:00:00" = '2024-10-27 02:00:00+01:00'
I would expect
str(pendulum.parse("2024-10-27 02:00:00", tz="Europe/Copenhagen").subtract(minutes=15)) to be equal = '2024-10-27 01:45:00+01:00'
I can get the expected value using:
str(pendulum.parse("2024-10-27 02:00:00", tz="Europe/Copenhagen").replace(fold=0).subtract(minutes=15))
'2024-10-27 01:45:00+02:00'
Issue
The fold attribute behaves weirdly when adding different timedeltas to a datetime object. Adding minutes changes the fold from 0 to 1. Adding days keeps it at 1.
On the other hand, when setting fold to 0, adding minutes preserves it, and adding days changes it.
It seems like adding minutes forces the fold attribute to be 0 and days forces it to be 1.
The text was updated successfully, but these errors were encountered: