- 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.
import pendulum
year, month, day = 2024, 5, 1
dt = pendulum.datetime(year, month, day, tz="CET")
print(dt.fold)
print(dt.add(minutes=1).fold)
print(dt.add(days=1).fold)
"""Output:
1
0
1
"""
dt = pendulum.datetime(year, month, day, tz="CET").replace(fold=0)
print(dt.fold)
print(dt.add(minutes=1).fold)
print(dt.add(days=1).fold)
"""Output:
0
0
1
"""
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.