Skip to content

Commit

Permalink
fix: derive dates from berlin timezone, not UTC (#265)
Browse files Browse the repository at this point in the history
Co-authored-by: Konstantin <konstantin.klein+github@hochfrequenz.de>
  • Loading branch information
hf-kklein and Konstantin authored Jan 12, 2025
1 parent c3c6241 commit a4a8369
Show file tree
Hide file tree
Showing 3 changed files with 1,454 additions and 1,427 deletions.
4 changes: 2 additions & 2 deletions src/edi_energy_scraper/apidocument.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ def _parse_datetime(cls, value: str | datetime) -> date:
is_probably_utc = naive_datetime.hour in {22, 23}
if is_probably_utc:
utc_datetime = datetime.fromisoformat(value).replace(tzinfo=timezone.utc)
berlin_datetime = utc_datetime.astimezone(_berlin_time)
else:
berlin_datetime = datetime.fromisoformat(value).replace(tzinfo=_berlin_time)
utc_datetime = berlin_datetime.astimezone(timezone.utc)
return utc_datetime.date()
return berlin_datetime.date()
if isinstance(value, datetime):
return value.date()
if isinstance(value, date):
Expand Down
Loading

0 comments on commit a4a8369

Please sign in to comment.