Skip to content

Commit 7ae07d2

Browse files
committed
Handle weekInfo across different browsers (fix Safari). Closes #214
1 parent 779b057 commit 7ae07d2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/svelte-ux/src/lib/utils/dateInternal.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ export function getWeekStartsOnFromIntl(locales?: string): DayOfWeek {
55
return DayOfWeek.Sunday;
66
}
77

8-
const info = new Intl.Locale(locales);
8+
const locale = new Intl.Locale(locales);
99
// @ts-ignore
10-
return (info.weekInfo.firstDay ?? 0) % 7; // (in Intl, sunday is 7 not 0, so we need to mod 7)
10+
const weekInfo = locale.weekInfo ?? locale.getWeekInfo?.();
11+
return (weekInfo?.firstDay ?? 0) % 7; // (in Intl, sunday is 7 not 0, so we need to mod 7)
1112
}

0 commit comments

Comments
 (0)