From ded56392efe24d6266a6cc283ef4ec675d3c64ca Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Thu, 17 Aug 2023 19:41:55 -0300 Subject: [PATCH] views/month: Use inclusive week end to format title Otherwise we end up with D+1 in the last date. --- src/gui/views/gcal-month-view.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/views/gcal-month-view.c b/src/gui/views/gcal-month-view.c index 1035dad3..e20eee8f 100644 --- a/src/gui/views/gcal-month-view.c +++ b/src/gui/views/gcal-month-view.c @@ -174,6 +174,7 @@ update_header_labels (GcalMonthView *self) { g_autoptr (GcalRange) first_visible_row_range = NULL; g_autoptr (GcalRange) last_visible_row_range = NULL; + g_autoptr (GDateTime) last_visible_date_exclusive = NULL; g_autoptr (GDateTime) first_visible_date = NULL; g_autoptr (GDateTime) last_visible_date = NULL; g_autofree gchar *month_string = NULL; @@ -189,7 +190,8 @@ update_header_labels (GcalMonthView *self) last_visible_row = g_ptr_array_index (self->week_rows, first_visible_row_index + N_ROWS_PER_PAGE - 1); last_visible_row_range = gcal_month_view_row_get_range (GCAL_MONTH_VIEW_ROW (last_visible_row)); - last_visible_date = gcal_range_get_end (last_visible_row_range); + last_visible_date_exclusive = gcal_range_get_end (last_visible_row_range); + last_visible_date = g_date_time_add_seconds (last_visible_date_exclusive, -1); if (g_date_time_get_month (first_visible_date) == g_date_time_get_month (last_visible_date)) {