mirror of
https://codeberg.org/vyn/mirai.git
synced 2025-07-02 09:23:18 +00:00
Fix Calendar first day of the week
This commit is contained in:
parent
fb0f21f119
commit
e18691d72c
1 changed files with 6 additions and 1 deletions
|
@ -15,8 +15,13 @@ ColumnLayout {
|
||||||
QtObject {
|
QtObject {
|
||||||
id: internal
|
id: internal
|
||||||
property date weekStartDate: {
|
property date weekStartDate: {
|
||||||
|
const firstDayOfTheWeek = 1 // 1 = Monday, hardcoded for now
|
||||||
const date = new Date()
|
const date = new Date()
|
||||||
date.setDate(date.getDate() - date.getDay() + 1)
|
let firstDayOfTheWeekDelta = date.getDay() - firstDayOfTheWeek
|
||||||
|
if (firstDayOfTheWeekDelta < 0) {
|
||||||
|
firstDayOfTheWeekDelta += 7
|
||||||
|
}
|
||||||
|
date.setDate(date.getDate() - firstDayOfTheWeekDelta)
|
||||||
return date
|
return date
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue