From 35d8e1237bacdfbc438120c6f07213acb1d9492b Mon Sep 17 00:00:00 2001 From: Fynn Feldpausch Date: Fri, 1 Dec 2023 10:49:54 +0100 Subject: [PATCH] fix(core): fix broken week day names in datepicker --- core/src/components/cat-datepicker/cat-datepicker.locale.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/components/cat-datepicker/cat-datepicker.locale.ts b/core/src/components/cat-datepicker/cat-datepicker.locale.ts index 7f204eaf..aa9e7c44 100644 --- a/core/src/components/cat-datepicker/cat-datepicker.locale.ts +++ b/core/src/components/cat-datepicker/cat-datepicker.locale.ts @@ -17,7 +17,7 @@ function getFirstDayOfWeek(language: string): number { function daysForLocale(language: string, weekday: 'long' | 'short' | 'narrow' = 'long') { const date = new Date(); - const firstDayOfWeek = date.getUTCDate() - date.getUTCDay(); + const firstDayOfWeek = (date.getUTCDate() - date.getUTCDay() + 7) % 7; const format = new Intl.DateTimeFormat(language, { weekday }).format; return [...Array(7).keys()].map(day => format(date.setUTCDate(firstDayOfWeek + day))); }