Skip to content

BUG: Fix inconsistency with DateOffset near DST #61870

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

arthurlw
Copy link
Member

@arthurlw arthurlw commented Jul 16, 2025

This fix ensures that pd.offsets.DateOffset(1) and pd.offsets.DateOffset(days=1) return the same value near a DST transition.

@@ -283,8 +283,10 @@ _relativedelta_kwds = {"years", "months", "weeks", "days", "year", "month",

cdef _determine_offset(kwds):
if not kwds:
from dateutil.relativedelta import relativedelta

# GH 45643/45890: (historically) defaults to 1 day
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the comment here needs adjusting?

@@ -1095,9 +1095,11 @@ def test_dateoffset_misc():

@pytest.mark.parametrize("n", [-1, 1, 3])
def test_construct_int_arg_no_kwargs_assumed_days(n):
from dateutil.relativedelta import relativedelta
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this go at the top of the file

@@ -1095,9 +1095,11 @@ def test_dateoffset_misc():

@pytest.mark.parametrize("n", [-1, 1, 3])
def test_construct_int_arg_no_kwargs_assumed_days(n):
from dateutil.relativedelta import relativedelta

# GH 45890, 45643
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update

@mroeschke mroeschke added the Frequency DateOffsets label Jul 16, 2025


def test_dateoffset_days_vs_n_near_dst_transition():
ts = Timestamp("2022-10-30", tz="Europe/Brussels")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GH ref

@jbrockmendel
Copy link
Member

can you add a whatsnew note

@arthurlw
Copy link
Member Author

pre-commit.ci autofix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Frequency DateOffsets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: DateOffset default temporal pattern does not work as expected with DST
3 participants