Skip to content

Commit

Permalink
Use aware UTC datetimes internally
Browse files Browse the repository at this point in the history
Avoids `utcfromtimestamp` deprecation warning on Python 3.12.
  • Loading branch information
scop committed Nov 22, 2023
1 parent 2dfa3de commit cbbe7e1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/meteofrance_api/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,6 @@ def timestamp_to_dateime_with_locale_tz(timestamp: int, local_tz: str) -> dateti
Datetime instance corresponding to the timestamp with a timezone.
"""
# convert timestamp in datetime with UTC timezone
dt_utc = utc.localize(datetime.utcfromtimestamp(timestamp))
dt_utc = datetime.fromtimestamp(timestamp, utc)
# convert datetime to local timezone
return dt_utc.astimezone(timezone(local_tz))

0 comments on commit cbbe7e1

Please sign in to comment.