From 898ec2df0093dfaf48be586ffe15de3cf198242b Mon Sep 17 00:00:00 2001 From: Leo Vasanko Date: Sun, 24 Aug 2025 17:10:30 -0600 Subject: [PATCH] FIrefox compatibility: fallbacks for missing Locale.weekInfo. --- src/utils/date.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/utils/date.js b/src/utils/date.js index 053b025..be9a7a2 100644 --- a/src/utils/date.js +++ b/src/utils/date.js @@ -234,13 +234,13 @@ function getLocalizedWeekdayNames(timeZone = DEFAULT_TZ) { } function getLocaleFirstDay() { - return new Intl.Locale(navigator.language).weekInfo.firstDay % 7 + const day = new Intl.Locale(navigator.language).weekInfo?.firstDay ?? 1 + return day % 7 } function getLocaleWeekendDays() { - const wk = new Intl.Locale(navigator.language).weekInfo.weekend || [6, 7] - const set = new Set(wk.map((d) => d % 7)) - return Array.from({ length: 7 }, (_, i) => set.has(i)) + const wk = new Set(new Intl.Locale(navigator.language).weekInfo?.weekend ?? [6, 7]) + return Array.from({ length: 7 }, (_, i) => wk.has(1 + ((i + 6) % 7))) } function reorderByFirstDay(days, firstDay) {