client: Add support for first day of week (closes #247)

This commit is contained in:
Elian Doran 2024-08-31 17:05:02 +03:00
parent 981ff34ac4
commit 5c326c553c
No known key found for this signature in database

View File

@ -167,11 +167,14 @@ export default class CalendarWidget extends RightDropdownButtonWidget {
// if it's the first day of the month // if it's the first day of the month
if (num === 1) { if (num === 1) {
if (day === 0) { // 0 1 2 3 4 5 6
$newDay.css("marginLeft", (6 * 14.28) + '%'); // Su Mo Tu We Th Fr Sa
} else { // 1 2 3 4 5 6 0
$newDay.css("marginLeft", `${(day - 1) * 14.28}%`); // Mo Tu We Th Fr Sa Su
} let dayOffset = day - this.firstDayOfWeek;
if (dayOffset < 0)
dayOffset = 7 + dayOffset;
$newDay.css("marginLeft", (dayOffset * 14.28) + '%');
} }
const dateNoteId = dateNotesForMonth[utils.formatDateISO(this.date)]; const dateNoteId = dateNotesForMonth[utils.formatDateISO(this.date)];