Merge pull request #13599 from Budibase/fix/calendary-start-of-week

Fix calendar using locale aware start of week
This commit is contained in:
Andrew Kingston 2024-05-02 15:24:42 +01:00 committed by GitHub
commit 3d4f9b81bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 1 deletions

View File

@ -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 = []