mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Use system timezone as TIMEZONE setting default
This commit is contained in:
parent
e6535eb6bc
commit
75d8251a29
@ -71,8 +71,10 @@ CHARTS_DISPLAY_TILES = false
|
||||
# prevent visitors from mindlessly clicking on those options and hogging your cpu
|
||||
DISCOURAGE_CPU_HEAVY_STATS = false
|
||||
|
||||
# offset to UTC
|
||||
TIMEZONE = 0
|
||||
# Use system timezone by default. Otherwise specify as either:
|
||||
# offset in hours IE 0 = UTC, -5 = EST
|
||||
# IANA time zone IE America/New_York = EST
|
||||
TIMEZONE = None
|
||||
|
||||
[Fluff]
|
||||
|
||||
|
@ -6,8 +6,13 @@ from os.path import commonprefix
|
||||
import math
|
||||
from doreah.settings import get_settings
|
||||
|
||||
# use system timezone as default
|
||||
# https://stackoverflow.com/a/39079819/1469797
|
||||
TIMEZONE = datetime.datetime.now(datetime.timezone.utc).astimezone().tzinfo
|
||||
# if user specifies a timezone in settings then try to use that instead
|
||||
OFFSET = get_settings("TIMEZONE")
|
||||
TIMEZONE = timezone(timedelta(hours=OFFSET))
|
||||
if OFFSET is not None:
|
||||
TIMEZONE = timezone(timedelta(hours=OFFSET))
|
||||
|
||||
FIRST_SCROBBLE = int(datetime.datetime.utcnow().replace(tzinfo=datetime.timezone.utc).timestamp())
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user