diff --git a/src/gcal-enums.h b/src/gcal-enums.h index df256330..5634543c 100644 --- a/src/gcal-enums.h +++ b/src/gcal-enums.h @@ -51,13 +51,13 @@ typedef enum typedef enum { GCAL_WEEK_DAY_INVALID = 0, - GCAL_WEEK_DAY_SUNDAY = 1 << 0, - GCAL_WEEK_DAY_MONDAY = 1 << 1, - GCAL_WEEK_DAY_TUESDAY = 1 << 2, - GCAL_WEEK_DAY_WEDNESDAY = 1 << 3, - GCAL_WEEK_DAY_THURSDAY = 1 << 4, - GCAL_WEEK_DAY_FRIDAY = 1 << 5, - GCAL_WEEK_DAY_SATURDAY = 1 << 6 + GCAL_WEEK_DAY_MONDAY = 1 << 0, + GCAL_WEEK_DAY_TUESDAY = 1 << 1, + GCAL_WEEK_DAY_WEDNESDAY = 1 << 2, + GCAL_WEEK_DAY_THURSDAY = 1 << 3, + GCAL_WEEK_DAY_FRIDAY = 1 << 4, + GCAL_WEEK_DAY_SATURDAY = 1 << 5, + GCAL_WEEK_DAY_SUNDAY = 1 << 6 } GcalWeekDay; typedef enum diff --git a/src/gui/common/gcal-date-chooser-day.c b/src/gui/common/gcal-date-chooser-day.c index ab278607..29f81980 100644 --- a/src/gui/common/gcal-date-chooser-day.c +++ b/src/gui/common/gcal-date-chooser-day.c @@ -199,7 +199,7 @@ gcal_date_chooser_day_set_date (GcalDateChooserDay *self, now = g_date_time_new_now (g_date_time_get_timezone (date)); today = gcal_date_time_compare_date (date, now) == 0; - weekday = g_date_time_get_day_of_week (date) % GCAL_N_WEEKDAYS; + weekday = g_date_time_get_day_of_week (date); if (G_UNLIKELY (today)) gtk_widget_add_css_class (widget, "today"); diff --git a/src/utils/gcal-utils.c b/src/utils/gcal-utils.c index 64a68aab..48b59650 100644 --- a/src/utils/gcal-utils.c +++ b/src/utils/gcal-utils.c @@ -549,7 +549,7 @@ struct /** * gcal_util_is_workday: - * @day: a guint representing the day of a week (0…Sunday, 6…Saturday) + * @day: a guint representing the ISO 8601 day of a week (1…Monday, 7…Sunday) * * Checks whether @day is workday or not based on the Territory part of Locale. * @@ -563,7 +563,7 @@ gcal_util_is_workday (guint day) gchar territory[3] = { 0, }; guint i; - if (day > GCAL_N_WEEKDAYS - 1) + if (day < 1 || day > GCAL_N_WEEKDAYS) return FALSE; no_work_days = GCAL_WEEK_DAY_SATURDAY | GCAL_WEEK_DAY_SUNDAY;