arrow-py / arrow-py/arrow

Arrow shift method is not handling DST properly

Open
#1,209 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
9.1k
Forks
784
PR merge metrics
No merged PRs in 30d

Description

## Issue Description
My understanding of shift method was it will take care of DST. However when testing for 10 hours shift on `2025-03-08T18:30:00` with `US/Central` and 10 hours shift the expected output should be `2025-03-09T05:30:00-05:00` but I am getting `2025-03-09T04:30:00-05:00`. Fyi, DST changes on March 9, 2025. At 2 a.m

```import arrow

# Step 1: Create a timezone-aware datetime using Arrow
start = arrow.get("2025-03-08T18:30:00").format('YYYY-MM-DDTHH:mm:ss') # starting datetime
start_tz = arrow.get(start).replace(tzinfo='US/Central') # Set the timezone to US/Central

# Step 2: Shift by 10 hours
shifted = start_tz.shift(hours=10)

# Step 3: Print the result
print(shifted) # Should print: 2025-03-09T05:30:00-05:00 (after DST transition) but getting
```

## System Info

- 🖥 **OS name and version**: macOS 15.3
- 🐍 **Python version**: 3.11.8
- 🏹 **Arrow version**: 1.3.0

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the reported Python reproduction using arrow.get(), replace(tzinfo='US/Central'), and shift(hours=10), then trace how Arrow handles the DST transition during shifting. Confirm the intended result against the provided timestamps and add a regression test demonstrating the expected output.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.