mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-02 17:31:14 -05:00
Really fix the timezones
Two main changes: - uses `astimezone` instead of `replace` because `replace` doesn’t handle daylight savings time correctly [1] - create the notifications one second before midnight in BST, because midnight is actually counted as being start of the _next_ day, month, etc 1. http://www.saltycrane.com/blog/2009/05/converting-time-zones-datetime-objects-python/#add-timezone-localize
This commit is contained in:
@@ -359,6 +359,6 @@ def get_april_fools(year):
|
||||
|
||||
|
||||
def get_bst_month(datetime):
|
||||
return pytz.utc.localize(datetime).replace(
|
||||
tzinfo=pytz.timezone("Europe/London")
|
||||
return pytz.utc.localize(datetime).astimezone(
|
||||
pytz.timezone("Europe/London")
|
||||
).strftime('%B')
|
||||
|
||||
Reference in New Issue
Block a user