From 710ee5fc8fb2036feaba2c399ff8e5043c88de74 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Wed, 17 Feb 2016 18:57:14 +0100 Subject: [PATCH] window: fix start & end ranges When we apply a timezone, the ranges change. Therefore, we should set the timezone to the date itself and then get the range. --- src/gcal-window.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/gcal-window.c b/src/gcal-window.c index 8cd8b98a..32a965f7 100644 --- a/src/gcal-window.c +++ b/src/gcal-window.c @@ -367,13 +367,12 @@ update_active_date (GcalWindow *window, date.minute = 0; date.second = 0; date.is_date = 0; - range_start = icaltime_as_timet_with_zone (date, default_zone); + date.zone = default_zone; + range_start = icaltime_as_timet (date); - date.day = 31; - date.month = 12; - date.hour = 23; - date.minute = 59; - range_end = icaltime_as_timet_with_zone (date, default_zone); + date.year++; + date = icaltime_normalize (date); + range_end = icaltime_as_timet (date); gcal_manager_set_subscriber (window->manager, E_CAL_DATA_MODEL_SUBSCRIBER (window->year_view), range_start, range_end); } @@ -387,12 +386,12 @@ update_active_date (GcalWindow *window, date.minute = 0; date.second = 0; date.is_date = 0; - range_start = icaltime_as_timet_with_zone (date, default_zone); + date.zone = default_zone; + range_start = icaltime_as_timet (date); - date.day = time_days_in_month (new_date->year, new_date->month - 1); - date.hour = 23; - date.minute = 59; - range_end = icaltime_as_timet_with_zone (date, default_zone); + date.month++; + date = icaltime_normalize (date); + range_end = icaltime_as_timet (date); gcal_manager_set_subscriber (window->manager, E_CAL_DATA_MODEL_SUBSCRIBER (window->month_view), range_start, range_end); }