isere-cd38: ens-calendar: change sunday weekdayindex to 7 instead 0 (#51310)

This commit is contained in:
Thomas Jund 2021-02-24 10:28:45 +01:00
parent 09c33cf308
commit 2d75688ef4
1 changed files with 7 additions and 7 deletions

View File

@ -63,7 +63,9 @@ $(function() {
date.value = (is$) ? day.value : day.id;
date.label = (is$) ? day.text : day.details;
date.number = (is$) ? day.dataset.daynumber : day.date_number ;
date.weekdayindex = (is$) ? day.dataset.weekdayindex : day.date_weekdayindex;
date.weekdayindex = parseInt((is$) ? day.dataset.weekdayindex : day.date_weekdayindex);
// French weekdayindex : sunday == 7 instead 0
date.weekdayindex = (date.weekdayindex == 0) ? 7 : date.weekdayindex;
date.weeknumber = (is$) ? day.dataset.weeknumber : day.date_weeknumber;
date.month = (is$) ? day.dataset.month : day.date_month;
date.idx = (is$) ? idx : idx + 1;
@ -144,7 +146,7 @@ $(function() {
return day.weeknumber === weeknumber;
});
// empty days before
const first_position = parseInt(days_of_week[0].weekdayindex);
const first_position = days_of_week[0].weekdayindex;
for (let i = 1; i < first_position; i++) {
days_markup += day_tpl();
}
@ -153,11 +155,9 @@ $(function() {
days_markup += day_tpl(day);
});
// empty days after
const last_position = parseInt(days_of_week[days_of_week.length - 1].weekdayindex);
if (last_position) {
for (let i = last_position; i < 7; i++) {
days_markup += day_tpl();
}
const last_position = days_of_week[days_of_week.length - 1].weekdayindex;
for (let i = last_position; i < 7; i++) {
days_markup += day_tpl();
}
// week raw
weeks_markup += '<tr class="' + prefix + 'week">' + days_markup + '</tr>';