From 667760eda81618a2cbd215b8d14c45e66a4b0524 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 2 May 2024 15:19:31 +0100 Subject: [PATCH] Fix calendar using locale aware start of week --- packages/bbui/src/Form/Core/DatePicker/Calendar.svelte | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/bbui/src/Form/Core/DatePicker/Calendar.svelte b/packages/bbui/src/Form/Core/DatePicker/Calendar.svelte index bc06530044..d7056db6d6 100644 --- a/packages/bbui/src/Form/Core/DatePicker/Calendar.svelte +++ b/packages/bbui/src/Form/Core/DatePicker/Calendar.svelte @@ -4,6 +4,9 @@ import dayjs from "dayjs" import NumberInput from "./NumberInput.svelte" import { createEventDispatcher } from "svelte" + import isoWeek from "dayjs/plugin/isoWeek" + + dayjs.extend(isoWeek) export let value @@ -43,7 +46,7 @@ return [] } let monthEnd = monthStart.endOf("month") - let calendarStart = monthStart.startOf("week") + let calendarStart = monthStart.startOf("isoWeek") const numWeeks = Math.ceil((monthEnd.diff(calendarStart, "day") + 1) / 7) let mondays = []