assiduites : meilleur gestion date UTC

This commit is contained in:
iziram 2023-02-20 22:21:26 +01:00
parent 6468bb30e4
commit b9554cd6b5

View File

@ -50,6 +50,7 @@ import numpy as np
from PIL import Image as PILImage
import pydot
import requests
from pytz import timezone
import dateutil.parser as dtparser
import flask
@ -220,12 +221,7 @@ def localize_datetime(date: datetime.datetime or str) -> datetime.datetime:
date = is_iso_formated(date, convert=True)
new_date: datetime.datetime = date
if date is not None and date.tzinfo is None:
# TOTALK: Paramètre scodoc pour avoir la timezone du serveur/ timezone paramétrée
time_zone: datetime.timezone = datetime.timezone(
datetime.timedelta(seconds=3600), "default"
)
new_date = date.replace(tzinfo=time_zone)
new_date = timezone("Europe/Paris").localize(date)
return new_date