return contact list created_at in UTC, not BST

make sure timestamps returned from the api are always consistent.

The only place in models where we're serializing a BST timestamp is on
the Notification.serialize_for_csv method now, which at least is a bit
different as this is user-facing (it also returns a formatted
human-readable notification_status for example).
This commit is contained in:
Leo Hemsted
2021-09-14 12:41:52 +01:00
parent 81a25ff1ef
commit 33ca817e17
2 changed files with 4 additions and 2 deletions

View File

@@ -2218,7 +2218,6 @@ class ServiceContactList(db.Model):
).first())
def serialize(self):
created_at_in_bst = convert_utc_to_bst(self.created_at)
contact_list = {
"id": str(self.id),
"original_file_name": self.original_file_name,
@@ -2228,7 +2227,7 @@ class ServiceContactList(db.Model):
"template_type": self.template_type,
"service_id": str(self.service_id),
"created_by": self.created_by.name,
"created_at": created_at_in_bst.strftime("%Y-%m-%d %H:%M:%S"),
"created_at": self.created_at.strftime(DATETIME_FORMAT),
}
return contact_list