You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the moment the PrayerConf object takes a timezone argument, which is a simple integer representing utc offset in hours.
This cannot work everywhere unless it is a float, as some regions have offsets that are not in hours.
Python provides a zoneinfo library to make selecting a timezone easier. The PrayerConf object could take one of these instead and still work internally in the same way.
`>>> zone = zoneinfo.ZoneInfo("America/Montreal")
import datetime
zone.utcoffset(datetime.datetime.now()).total_seconds
<built-in method total_seconds of datetime.timedelta object at 0x7f88fcbbd410>
zone.utcoffset(datetime.datetime.now()).total_seconds()
-14400.0
zone.utcoffset(datetime.datetime.now()).total_seconds() / 3600.0
-4.0`
And on my Linux box, it is simple enough to read the symlink /etc/localtime and determine this for the user.
$ ls -l /etc/localtime lrwxrwxrwx 1 root root 35 May 2 2023 /etc/localtime -> /usr/share/zoneinfo/America/Toronto
So why not make this simpler for the front-end and use the zoneinfo library?
Regards...
The text was updated successfully, but these errors were encountered:
At the moment the PrayerConf object takes a timezone argument, which is a simple integer representing utc offset in hours.
This cannot work everywhere unless it is a float, as some regions have offsets that are not in hours.
Python provides a zoneinfo library to make selecting a timezone easier. The PrayerConf object could take one of these instead and still work internally in the same way.
`>>> zone = zoneinfo.ZoneInfo("America/Montreal")
And on my Linux box, it is simple enough to read the symlink /etc/localtime and determine this for the user.
$ ls -l /etc/localtime lrwxrwxrwx 1 root root 35 May 2 2023 /etc/localtime -> /usr/share/zoneinfo/America/Toronto
So why not make this simpler for the front-end and use the zoneinfo library?
Regards...
The text was updated successfully, but these errors were encountered: