Set time to UTC

This commit is contained in:
ZKWolf 2024-04-25 03:31:09 +02:00
parent a3e8798f7a
commit 126884155c

View File

@ -34,11 +34,11 @@ def get_lifetime(challenge_type):
# "expirationTime":"2019-11-25T17:59:59.000Z"
# }
if challenge_type == "Daily":
creation_time = datetime.datetime.now().isoformat(timespec='milliseconds')
expiration_time = (datetime.datetime.now() + datetime.timedelta(days=1)).replace(hour=23, minute=59, second=59, microsecond=0).isoformat(timespec='milliseconds')
creation_time = datetime.datetime.now(datetime.timezone.utc).isoformat(timespec='milliseconds')
expiration_time = (datetime.datetime.now(datetime.timezone.utc) + datetime.timedelta(days=1)).replace(hour=23, minute=59, second=59, microsecond=0).isoformat(timespec='milliseconds')
elif challenge_type == "Weekly":
creation_time = datetime.datetime.now().isoformat(timespec='milliseconds')
expiration_time = (datetime.datetime.now() + datetime.timedelta(days=7)).replace(hour=23, minute=59, second=59, microsecond=0).isoformat(timespec='milliseconds')
creation_time = datetime.datetime.now(datetime.timezone.utc).isoformat(timespec='milliseconds')
expiration_time = (datetime.datetime.now(datetime.timezone.utc) + datetime.timedelta(days=7)).replace(hour=23, minute=59, second=59, microsecond=0).isoformat(timespec='milliseconds')
else:
return None
return creation_time, expiration_time