From 96d2b37fec5c32709a5d0d6a3d2bd83ecf5d366e Mon Sep 17 00:00:00 2001 From: fosero Date: Sun, 6 Mar 2016 14:03:20 +0100 Subject: [PATCH] month-view: fix end-of-month multi-day selections Use g_date_time_add_days to add a day to the final day of the month to fix behaviour when selecting a range up to the last day of the month. https://bugzilla.gnome.org/show_bug.cgi?id=763015 --- src/gcal-month-view.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/gcal-month-view.c b/src/gcal-month-view.c index 6574f6ec..0d91d9c8 100644 --- a/src/gcal-month-view.c +++ b/src/gcal-month-view.c @@ -282,7 +282,14 @@ show_popover_for_position (GcalMonthView *view, /* Only setup an end date when days are different */ if (start_day != end_day) - end_dt = g_date_time_new_local (priv->date->year, priv->date->month, end_day + 1, 0, 0, 0); + { + GDateTime *tmp_dt; + + tmp_dt = g_date_time_new_local (priv->date->year, priv->date->month, end_day, 0, 0, 0); + end_dt = g_date_time_add_days (tmp_dt, 1); + + g_clear_pointer (&tmp_dt, g_date_time_unref); + } g_signal_emit_by_name (GCAL_VIEW (widget), "create-event", start_dt, end_dt, x, y);