[gnome-calendar] edit-dialog: Don't convert date to timezone if all-day



commit 6e5372189d76037091527f22bbe68d4aff3f91c5
Author: Florian Latifi <mail florian-latifi at>
Date:   Wed Feb 6 02:33:02 2019 +0100

    edit-dialog: Don't convert date to timezone if all-day
    
    When the all-day checkbox is ticked, transforming to the
    UTC timezone may change the dates of the event. On positive
    timezone offsets, this happens frequently.
    
    Fix that by only transforming to a timezone when the event
    is not marked as all-day.
    
    Fixes https://gitlab.gnome.org/GNOME/gnome-calendar/issues/338

 src/gui/gcal-edit-dialog.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/gui/gcal-edit-dialog.c b/src/gui/gcal-edit-dialog.c
index 10d2fcba..fd83eaaf 100644
--- a/src/gui/gcal-edit-dialog.c
+++ b/src/gui/gcal-edit-dialog.c
@@ -316,14 +316,17 @@ return_datetime_for_widgets (GcalEditDialog   *self,
                                             all_day ? 0 : g_date_time_get_minute (time),
                                             0);
 
-  date_in_best_tz = g_date_time_to_timezone (date_in_local_tz, timezone);
+  if (all_day)
+    date_in_best_tz = g_date_time_ref (date_in_local_tz);
+  else
+    date_in_best_tz = g_date_time_to_timezone (date_in_local_tz, timezone);
 
   retval = g_date_time_new (timezone,
                             g_date_time_get_year (date_in_best_tz),
                             g_date_time_get_month (date_in_best_tz),
                             g_date_time_get_day_of_month (date_in_best_tz),
-                            all_day ? 0 : g_date_time_get_hour (date_in_best_tz),
-                            all_day ? 0 : g_date_time_get_minute (date_in_best_tz),
+                            g_date_time_get_hour (date_in_best_tz),
+                            g_date_time_get_minute (date_in_best_tz),
                             0);
 
   return retval;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]