This commit is contained in:
2024-04-11 18:19:47 +02:00
parent dfad84286f
commit d9970f2111

View File

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