This commit is contained in:
2024-04-11 09:04:00 +02:00
parent d856b83ec0
commit 79537f77ad

View File

@@ -163,7 +163,11 @@ class cls_caldav():
def convert_to_gmt1(self, dt): def convert_to_gmt1(self, dt):
gmt1_tz = pytz.timezone('Europe/Paris') gmt1_tz = pytz.timezone('Europe/Paris')
if hasattr(dt,"tzinfo") and dt.tzinfo is not None: utc_tz = pytz.utc
dt_utc = utc_tz.localize(dt)
dt_gmt1 = dt_utc.astimezone(gmt1_tz)
'''if hasattr(dt,"tzinfo") and dt.tzinfo is not None:
# Convertir l'objet datetime en GMT+1 # Convertir l'objet datetime en GMT+1
# Utilisez le nom de votre fuseau horaire GMT+1 # Utilisez le nom de votre fuseau horaire GMT+1
dt_gmt1 = dt.astimezone(gmt1_tz) dt_gmt1 = dt.astimezone(gmt1_tz)
@@ -171,7 +175,7 @@ class cls_caldav():
# L'objet datetime est naïf, ajouter l'information de fuseau horaire GMT+1 # L'objet datetime est naïf, ajouter l'information de fuseau horaire GMT+1
utc_tz = pytz.utc utc_tz = pytz.utc
dt_utc = utc_tz.localize(dt) dt_utc = utc_tz.localize(dt)
dt_gmt1 = dt_utc.astimezone(gmt1_tz) dt_gmt1 = dt_utc.astimezone(gmt1_tz)'''
return dt_gmt1 return dt_gmt1
def parse_data(self, events): def parse_data(self, events):
desired_timezone = pytz.timezone('Europe/Paris') desired_timezone = pytz.timezone('Europe/Paris')