Added ability to set own time format, GH-82

This commit is contained in:
krateng 2021-10-14 18:07:38 +02:00
parent 08cc32ac33
commit d3e45b138b
3 changed files with 4 additions and 2 deletions

View File

@ -5,7 +5,7 @@ author = {
"email":"maloja@dev.krateng.ch",
"github": "krateng"
}
version = 2,12,11
version = 2,12,12
versionstr = ".".join(str(n) for n in version)
links = {
"pypi":"malojaserver",

View File

@ -85,6 +85,7 @@ DISCOURAGE_CPU_HEAVY_STATS = false
# Offset in hours to UTC
TIMEZONE = 0
TIME_FORMAT = "%d. %b %Y %I:%M %p" # use '%H:%M' instead of '%I:%M %p' for 24 hour clock
[Fluff]

View File

@ -535,7 +535,8 @@ def timestamp_desc(t,short=False):
return timeobject.strftime("%Y")
else:
timeobject = datetime.datetime.fromtimestamp(t,tz=TIMEZONE)
return timeobject.strftime("%d. %b %Y %I:%M %p")
format = get_settings("TIME_FORMAT")
return timeobject.strftime(format)