[gnome-calendar] event: normalize dates before applying them
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] event: normalize dates before applying them
- Date: Tue, 16 Feb 2016 01:41:35 +0000 (UTC)
commit 3f4d11f68e5a66b9b9804b4fdaaeb8f4eab03f40
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Tue Feb 16 10:39:37 2016 +0900
event: normalize dates before applying them
I don't know the reasoning behind it, but sometimes
I see dates like March 32 or February 30. Events are
correctly added, so I suspect it's an issue with another
app.
In any case, we should be able to handle weird dates
without crashing, so normalize the dates before using
them.
src/gcal-event.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/gcal-event.c b/src/gcal-event.c
index 937edb3..e60df48 100644
--- a/src/gcal-event.c
+++ b/src/gcal-event.c
@@ -181,6 +181,7 @@ gcal_event_set_component_internal (GcalEvent *self,
{
ECalComponentDateTime start;
ECalComponentDateTime end;
+ icaltimetype normalized_date;
GDateTime *date_start;
GTimeZone *zone_start;
GDateTime *date_end;
@@ -191,8 +192,9 @@ gcal_event_set_component_internal (GcalEvent *self,
/* Setup start date */
e_cal_component_get_dtstart (component, &start);
+ normalized_date = icaltime_normalize (*start.value);
zone_start = get_timezone_from_ical (&start);
- aux = icaltime_to_datetime (start.value);
+ aux = icaltime_to_datetime (&normalized_date);
date_start = g_date_time_to_timezone (aux, zone_start);
start_is_all_day = datetime_is_date (aux);
@@ -205,8 +207,9 @@ gcal_event_set_component_internal (GcalEvent *self,
/* Setup end date */
e_cal_component_get_dtend (component, &end);
+ normalized_date = icaltime_normalize (*end.value);
zone_end = get_timezone_from_ical (&end);
- aux = icaltime_to_datetime (end.value);
+ aux = icaltime_to_datetime (&normalized_date);
date_end = g_date_time_to_timezone (aux, zone_end);
end_is_all_day = datetime_is_date (aux);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]