From a7304ed9b0bb3e69fc06162ffefb79d6c6ac76d3 Mon Sep 17 00:00:00 2001 From: Michael Catanzaro Date: Tue, 5 Dec 2017 17:36:14 -0600 Subject: [PATCH] event: Restore handling of all day events This brings back the original handling of all day events that we had before I reverted the previous commit. --- src/gcal-event.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/gcal-event.c b/src/gcal-event.c index d9c7fe7d..dc606635 100644 --- a/src/gcal-event.c +++ b/src/gcal-event.c @@ -225,24 +225,28 @@ build_component_from_datetime (GcalEvent *self, GDateTime *dt) { ECalComponentDateTime *comp_dt; - gchar *tzid; if (!dt) return NULL; comp_dt = g_new0 (ECalComponentDateTime, 1); - comp_dt->value = NULL; - comp_dt->tzid = NULL; - - tzid = g_date_time_format (dt, "%Z"); - comp_dt->value = datetime_to_icaltime (dt); - comp_dt->value->zone = icaltimezone_get_builtin_timezone_from_tzid (tzid); comp_dt->value->is_date = self->all_day; - /* All day events have no timezone */ - if (!self->all_day) - comp_dt->tzid = tzid; + if (self->all_day) + { + comp_dt->value->zone = icaltimezone_get_utc_timezone (); + comp_dt->tzid = g_strdup ("UTC"); + } + else + { + gchar *tzid; + + tzid = g_date_time_format (dt, "%Z"); + comp_dt->value->zone = icaltimezone_get_builtin_timezone_from_tzid (tzid); + /* This transfers ownership of tzid. */ + comp_dt->tzid = tzid; + } return comp_dt; }