date-chooser: Clamp to first day of month when clicking previous/next buttons
When clicking the previous/next buttons, the view might not be aligned to the start of the month, which can cause confusion. Clamping the date to the first of the month removes this confusion by being consistent. This also matches the behavior of the previous/next buttons in the main toolbar. Closes #1606 Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/821>
This commit is contained in:
@@ -599,6 +599,9 @@ gcal_date_chooser_set_date (GcalView *view,
|
||||
g_date_time_get_ymd (self->date, &y1, &m1, &d1);
|
||||
g_date_time_get_ymd (date, &y2, &m2, &d2);
|
||||
|
||||
if (y1 != y2 || m1 != m2)
|
||||
d2 = 1;
|
||||
|
||||
gcal_set_date_time (&self->date, date);
|
||||
|
||||
if (y1 != y2 || m1 != m2 || d1 != d2)
|
||||
|
||||
Reference in New Issue
Block a user