Skip to content

Pull latest#176

Open
HiDiHo01 wants to merge 4 commits intondokter:masterfrom
HiDiHo01:master
Open

Pull latest#176
HiDiHo01 wants to merge 4 commits intondokter:masterfrom
HiDiHo01:master

Conversation

@HiDiHo01
Copy link
Contributor

No description provided.

HA is moving away from pytz
Tested with Python 3.14 HA 2026.2.0
Replaced astimezone().astimezone(timezone.utc) with single time convertion astimezone(timezone.utc)
Improvements Made

1. Replaced pytz with zoneinfo
zoneinfo is part of the standard library since Python 3.9.
No .localize() required.
Proper support for fold during DST transitions.

2. Fully timezone-aware
No naive datetimes returned.
Output is always UTC-aware.

3. Safer DST handling
Uses fold instead of is_dst.
Explicit validation of DST flag.

4. Input validation
Type checking
Length checking
Flag validation

5. Explicit typing
datetime | None
Clear return contract
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant