Missing hour during DST long day when shifting or calculating ranges
- Dominant language
- Python
- Stars
- 9.1k
- Forks
- 784
- PR merge metrics
- No merged PRs in 30d
Description
## Issue Description
When iterating or shifting over times that cross the DST long day change, an hour is skipped when the time zone is set for something other than UTC.
The following demonstrates the issue where the first loop prints 2 hours for the span, but converting those same timestamps to UTC prints 3 hours (correctly). It's also strange that the tzinfo has to be set for the ISO timestamp containing the offset hours.
```
dts = arrow.get("2021-11-07T01:00:00-05:00", tzinfo="US/Central")
dte = arrow.get("2021-11-07T02:00:00-06:00", tzinfo="US/Central")
for dt in Arrow.range("hours", dts, dte):
print(dt)
print("---BREAK---")
dts = arrow.get("2021-11-07T01:00:00-05:00", tzinfo="US/Central").to("UTC")
dte = arrow.get("2021-11-07T02:00:00-06:00", tzinfo="US/Central").to("UTC")
for dt in Arrow.range("hours", dts, dte):
print(dt)
```
## System Info
- 🖥 Ubuntu 22.04.3 LTS
- 🐍 Python 3.10.12
- 🏹 Arrow 1.2.3
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the reported arrow.get and Arrow.range calls, reproducing the 2021-11-07 US/Central case and comparing it with the UTC-converted case. Trace how range iteration and time shifting handle timezone offsets across the DST long day. Done means the local-time range includes the same three hours as the equivalent UTC range, with regression coverage for this example.
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
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100