Skip to content

Commit

Permalink
fix: use utc for converted timestamps
Browse files Browse the repository at this point in the history
  • Loading branch information
acouch committed Feb 7, 2023
1 parent 582d1d2 commit c9d1a1e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions website/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def month_name(month_number):

def datetime_format(value, format="%H:%M %d-%m-%y"):
if isinstance(value, int):
return datetime.fromtimestamp(value / 1e3).strftime(format)
return datetime.utcfromtimestamp(value / 1e3).strftime(format)
return value.strftime(format)

def string_to_html_id(s):
Expand All @@ -70,22 +70,22 @@ def friendly_month(x):
return datetime.strptime(x, "%Y-%m-%d").strftime("%B")

def friendly_month_from_int(x):
return datetime.fromtimestamp(x / 1e3).strftime("%B")
return datetime.utcfromtimestamp(x / 1e3).strftime("%B")

def friendly_month_day(x):
return datetime.strptime(x, "%Y-%m-%d").strftime("%B %d")

def friendly_month_day_from_int(x):
return datetime.fromtimestamp(x / 1e3).strftime("%B %d")
return datetime.utcfromtimestamp(x / 1e3).strftime("%B %d")

def friendly_month_year(x):
return datetime.strptime(x, "%Y-%m-%d").strftime("%B %Y")

def friendly_month_year_from_int(x):
return datetime.fromtimestamp(x / 1e3).strftime("%B %Y")
return datetime.utcfromtimestamp(x / 1e3).strftime("%B %Y")

def friendly_month_day_year_from_int(x):
return datetime.fromtimestamp(x / 1e3).strftime('%m-%d-%Y')
return datetime.utcfromtimestamp(x / 1e3).strftime('%m-%d-%Y')

def friendly_month_day_year_from_string(x):
return datetime.strptime(x, '%Y%m%d').strftime('%m-%d-%Y')
Expand Down

0 comments on commit c9d1a1e

Please sign in to comment.