mirror of
https://github.com/nfonteyne/octane-website.git
synced 2026-09-03 23:24:48 +02:00
fix: show next 28 days
This commit is contained in:
parent
bb12667a7c
commit
c124f3ce73
1 changed files with 3 additions and 3 deletions
|
|
@ -125,21 +125,21 @@ function renderCalendar() {
|
||||||
start.setDate(start.getDate() + (dow === 0 ? -6 : 1 - dow));
|
start.setDate(start.getDate() + (dow === 0 ? -6 : 1 - dow));
|
||||||
|
|
||||||
const daysBeforeToday = Math.round((today - start) / 86400000);
|
const daysBeforeToday = Math.round((today - start) / 86400000);
|
||||||
const totalDays = Math.ceil((daysBeforeToday + 21) / 7) * 7;
|
const totalDays = Math.ceil((daysBeforeToday + 28) / 7) * 7;
|
||||||
|
|
||||||
for (let i = 0; i < totalDays; i++) {
|
for (let i = 0; i < totalDays; i++) {
|
||||||
const date = new Date(start);
|
const date = new Date(start);
|
||||||
date.setDate(start.getDate() + i);
|
date.setDate(start.getDate() + i);
|
||||||
|
|
||||||
const isPastDay = date < today;
|
const isPastDay = date < today;
|
||||||
const isBeyond21 = i >= daysBeforeToday + 21;
|
const isBeyondRange = i >= daysBeforeToday + 28;
|
||||||
const isToday = date.getTime() === today.getTime();
|
const isToday = date.getTime() === today.getTime();
|
||||||
const slot = slotMap.get(isoDate(date));
|
const slot = slotMap.get(isoDate(date));
|
||||||
|
|
||||||
const cell = document.createElement('div');
|
const cell = document.createElement('div');
|
||||||
cell.className = 'cal-cell' + (isToday ? ' today' : '');
|
cell.className = 'cal-cell' + (isToday ? ' today' : '');
|
||||||
|
|
||||||
if (isBeyond21) {
|
if (isBeyondRange) {
|
||||||
cell.classList.add('empty');
|
cell.classList.add('empty');
|
||||||
grid.appendChild(cell);
|
grid.appendChild(cell);
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue