adafruit / adafruit/Adafruit_CircuitPython_datetime

TZ and zoneinfo support

Open
#26 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
4
Forks
6
PR merge metrics
No merged PRs in 30d

Description

What is the correct way to convert datetime (utc) to [arbitrary] timezone? Looks like this lib supports neither `zoneinfo` module nor `astimezone()` method...

[Example](https://docs.python.org/3/library/zoneinfo.html) I would like to run in CircuitPython:
```
from datetime import timezone
LOS_ANGELES = ZoneInfo("America/Los_Angeles")
dt_utc = datetime(2020, 11, 1, 8, tzinfo=timezone.utc)

# Before the PDT -> PST transition
print(dt_utc.astimezone(LOS_ANGELES))

# After the PDT -> PST transition
print((dt_utc + timedelta(hours=1)).astimezone(LOS_ANGELES))
```

Contributor guide

No contributing guide indexed for this repository

Research direction

No source file or test is named. Start by reviewing this repository's datetime subset and the linked CPython zoneinfo example, then determine the scope needed for timezone conversion and astimezone() support. Done means the supplied CircuitPython example works across the PDT-to-PST transition.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.