1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00

Added setting for timezone

This commit is contained in:
Krateng 2020-12-01 18:59:39 +01:00
parent c87dc32455
commit e475b0c716
2 changed files with 8 additions and 1 deletions

View File

@ -71,6 +71,9 @@ CHARTS_DISPLAY_TILES = false
# prevent visitors from mindlessly clicking on those options and hogging your cpu # prevent visitors from mindlessly clicking on those options and hogging your cpu
DISCOURAGE_CPU_HEAVY_STATS = false DISCOURAGE_CPU_HEAVY_STATS = false
# offset to UTC
TIMEZONE = 0
[Fluff] [Fluff]
# how many scrobbles a track needs to aquire this status # how many scrobbles a track needs to aquire this status

View File

@ -1,9 +1,13 @@
import datetime import datetime
from datetime import datetime as dtm from datetime import datetime as dtm
from datetime import timezone, timedelta
from calendar import monthrange from calendar import monthrange
from os.path import commonprefix from os.path import commonprefix
import math import math
from doreah.settings import get_settings
OFFSET = get_settings("TIMEZONE")
TIMEZONE = timezone(timedelta(hours=OFFSET))
FIRST_SCROBBLE = int(datetime.datetime.utcnow().replace(tzinfo=datetime.timezone.utc).timestamp()) FIRST_SCROBBLE = int(datetime.datetime.utcnow().replace(tzinfo=datetime.timezone.utc).timestamp())
@ -545,7 +549,7 @@ def timestamp_desc(t,short=False):
return timeobject.strftime("%Y") return timeobject.strftime("%Y")
else: else:
timeobject = datetime.datetime.fromtimestamp(t) timeobject = datetime.datetime.fromtimestamp(t,tz=TIMEZONE)
return timeobject.strftime("%d. %b %Y %I:%M %p") return timeobject.strftime("%d. %b %Y %I:%M %p")