fix(calendar): use dynamic year range instead of hardcoded 2026 (#1)
currentYear now initializes to the current year and the year selector offers a rolling range (this year -1 to +2) so plans can be created for years other than 2026. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
6736021af1
commit
700ec6de1c
1 file changed
+9
-6
+9
-6
@@ -7,7 +7,7 @@ const MONTHS = ['Januar','Februar','März','April','Mai','Juni',
|
||||
'Juli','August','September','Oktober','November','Dezember'];
|
||||
const WD_LABELS = ['Mo','Di','Mi','Do','Fr','Sa','So'];
|
||||
|
||||
let currentYear = 2026;
|
||||
let currentYear = new Date().getFullYear();
|
||||
let currentMonth = Math.min(Math.max(new Date().getMonth() + 1, 1), 12);
|
||||
let currentPlan = []; // [{ date, employeeId, manual }] for displayed month
|
||||
|
||||
@@ -41,11 +41,14 @@ export function renderCalendar() {
|
||||
yearLabel.textContent = 'Jahr:';
|
||||
|
||||
const yearSel = document.createElement('select');
|
||||
const yearOpt = document.createElement('option');
|
||||
yearOpt.value = '2026';
|
||||
yearOpt.textContent = '2026';
|
||||
yearOpt.selected = true;
|
||||
yearSel.appendChild(yearOpt);
|
||||
const thisYear = new Date().getFullYear();
|
||||
for (let y = thisYear - 1; y <= thisYear + 2; y++) {
|
||||
const opt = document.createElement('option');
|
||||
opt.value = String(y);
|
||||
opt.textContent = String(y);
|
||||
if (y === currentYear) opt.selected = true;
|
||||
yearSel.appendChild(opt);
|
||||
}
|
||||
|
||||
const slotsLabel = document.createElement('label');
|
||||
slotsLabel.textContent = 'Pro Tag:';
|
||||
|
||||
Reference in new issue
Block a user