utils: Use ISO weekday numbering for 'get_first_weekday' function

Change the 'get_first_weekday' function to number the weekdays
Monday(1)-Sunday(7) like ISO does. Change the function name to reflect
that. Add tests for different locales, although the tests depend on
system-installed locales.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/822>
This commit is contained in:
mindonwarp
2026-09-26 17:22:00 +00:00
committed by Marge Bot
parent a0a6ae2a2c
commit acd8fbaf69
8 changed files with 74 additions and 25 deletions
+1 -1
View File
@@ -1083,7 +1083,7 @@ gcal_date_chooser_init (GcalDateChooser *self)
self->date = g_date_time_new_now_local ();
g_date_time_get_ymd (self->date, &self->this_year, NULL, NULL);
self->week_start = gcal_util_get_first_weekday ();
self->week_start = gcal_util_get_first_weekday_iso ();
gtk_widget_init_template (GTK_WIDGET (self));
+1 -1
View File
@@ -194,7 +194,7 @@ allocate_overflow_popover (GcalMonthView *self,
static inline void
update_weekday_labels (GcalMonthView *self)
{
const gint first_weekday = gcal_util_get_first_weekday ();
const gint first_weekday = gcal_util_get_first_weekday_iso ();
for (gint i = 0; i < GCAL_N_WEEKDAYS; i++)
{
-4
View File
@@ -100,8 +100,6 @@ struct _GcalWeekHeader
GtkWidget *overflow_label[GCAL_N_WEEKDAYS];
WeekdayHeader weekday_header[GCAL_N_WEEKDAYS];
gint first_weekday;
/*
* Used for checking if the header is in collapsed state or expand state
* false is collapse state true is expand state
@@ -1762,8 +1760,6 @@ gcal_week_header_init (GcalWeekHeader *self)
gtk_widget_set_visible (self->dnd.widget, FALSE);
gtk_widget_set_parent (self->dnd.widget, GTK_WIDGET (self));
self->first_weekday = gcal_util_get_first_weekday ();
gtk_widget_init_template (GTK_WIDGET (self));
for (i = 0; i < GCAL_N_WEEKDAYS; i++)