Skip to content

Draft: dep change: give up and start using tzlocal instead of our hack

Antoine Beaupré requested to merge tzlocal-crash into main

We had a really weird hack to figure out the local timezone. It was based on this StackOverflow answer that doesn't work once you start overriding the current timezone with ... more exotic zones. For example, this crashes:

TZ=:Asia/Singapore undertime -- tomorrow

with:

pytz.exceptions.UnknownTimeZoneError: '+08'

That's because we pass down "+08" (the string) as a timezone to dateparser which, obviously, is not really a zone (it's an offset, and worse, as a string).

I have tried dateutil.tz.tzlocal() but this breaks our tests. This needs unit tests as well.

Merge request reports