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
This commit is contained in:
Florian Latifi
2019-05-10 11:49:14 -03:00
parent 7ad0f100a7
commit 6e5372189d
+6 -3
View File
@@ -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;