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:
parent
c87dc32455
commit
e475b0c716
@ -71,6 +71,9 @@ 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
|
||||
|
||||
[Fluff]
|
||||
|
||||
# how many scrobbles a track needs to aquire this status
|
||||
|
@ -1,9 +1,13 @@
|
||||
import datetime
|
||||
from datetime import datetime as dtm
|
||||
from datetime import timezone, timedelta
|
||||
from calendar import monthrange
|
||||
from os.path import commonprefix
|
||||
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())
|
||||
|
||||
@ -545,7 +549,7 @@ def timestamp_desc(t,short=False):
|
||||
|
||||
return timeobject.strftime("%Y")
|
||||
else:
|
||||
timeobject = datetime.datetime.fromtimestamp(t)
|
||||
timeobject = datetime.datetime.fromtimestamp(t,tz=TIMEZONE)
|
||||
return timeobject.strftime("%d. %b %Y %I:%M %p")
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user