From 63c37c6334885bd50f0ce1128dd9de0fb6834a55 Mon Sep 17 00:00:00 2001 From: Oscar Krause Date: Wed, 13 Nov 2024 15:03:12 +0100 Subject: [PATCH] fixed timezone in json response --- app/orm.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/orm.py b/app/orm.py index b13ed38..53109ed 100644 --- a/app/orm.py +++ b/app/orm.py @@ -1,4 +1,4 @@ -from datetime import datetime, timedelta +from datetime import datetime, timedelta, timezone from dateutil.relativedelta import relativedelta from sqlalchemy import Column, VARCHAR, CHAR, ForeignKey, DATETIME, update, and_, inspect, text @@ -94,10 +94,10 @@ class Lease(Base): 'lease_ref': self.lease_ref, 'origin_ref': self.origin_ref, # 'scope_ref': self.scope_ref, - 'lease_created': self.lease_created.isoformat(), - 'lease_expires': self.lease_expires.isoformat(), - 'lease_updated': self.lease_updated.isoformat(), - 'lease_renewal': lease_renewal.isoformat(), + 'lease_created': self.lease_created.replace(tzinfo=timezone.utc).isoformat(), + 'lease_expires': self.lease_expires.replace(tzinfo=timezone.utc).isoformat(), + 'lease_updated': self.lease_updated.replace(tzinfo=timezone.utc).isoformat(), + 'lease_renewal': lease_renewal.replace(tzinfo=timezone.utc).isoformat(), } @staticmethod