-
-
Notifications
You must be signed in to change notification settings - Fork 409
Open
Description
-
I am on the latest Pendulum version.
-
I have searched the issues of this repo and believe that this is not a duplicate.
-
OS version and name: macOS 13.2.1 (22D68)
-
Pendulum version: 3.0.0
Issue
Hi,
It seems like pendulum.DateTime additions of timedelta don't give the same result as in the case of pendulum.Duration additions when crossing a DST timezone boundary.
Examples:
assert DateTime(year=2024, month=11, day=3, hour=1, tzinfo=Timezone("America/Los_Angeles")) + timedelta(days=30) == DateTime(year=2024, month=12, day=3, hour=1, tzinfo=Timezone("America/Los_Angeles"))
throws the following:
AssertionError: assert DateTime(2024, 12, 3, 0, 0, 0, tzinfo=Timezone('America/Los_Angeles')) == DateTime(2024, 12, 3, 1, 0, 0, tzinfo=Timezone('America/Los_Angeles'))
the same assertion passes if adding a Duration instead of timedelta:
assert DateTime(year=2024, month=11, day=3, hour=1, tzinfo=Timezone("America/Los_Angeles")) + Duration(months=1) == DateTime(year=2024, month=12, day=3, hour=1, tzinfo=Timezone("America/Los_Angeles"))
The issue is also reproducible when adding weeks:
assert DateTime(year=2024, month=11, day=3, hour=1, tzinfo=Timezone("America/Los_Angeles")) + timedelta(weeks=1) == DateTime(year=2024, month=11, day=10, hour=1, tzinfo=Timezone("America/Los_Angeles"))
Metadata
Metadata
Assignees
Labels
No labels