1
0
mirror of https://github.com/axzilla/templui.git synced 2025-02-06 10:44:17 +00:00

fix(datepicker): shift blankdays by 1 to show correct days

This commit is contained in:
axzilla 2025-01-30 15:57:13 +07:00
parent 1314acba11
commit d32481c39b
2 changed files with 10 additions and 8 deletions

View File

@ -217,9 +217,11 @@ templ DatepickerScript() {
},
calculateDays() {
const firstDay = new Date(this.currentYear, this.currentMonth, 1).getDay();
let firstDay = new Date(this.currentYear, this.currentMonth, 1).getDay();
const daysInMonth = new Date(this.currentYear, this.currentMonth + 1, 0).getDate();
firstDay = firstDay === 0 ? 6 : firstDay - 1;
this.blankDays = Array.from({ length: firstDay }, (_, i) => i);
this.monthDays = Array.from({ length: daysInMonth }, (_, i) => i + 1);
},

File diff suppressed because one or more lines are too long