fix: synchronize calendar month input and add month navigation

This commit is contained in:
2026-09-06 14:08:08 +03:00
parent 6c33012ab8
commit 525b673e25
5 changed files with 30 additions and 3 deletions
+7
View File
@@ -86,3 +86,10 @@ export function calendarAgenda(tenders, now=new Date()) {
undated.sort(compare);
return {days,undated};
}
export function shiftCalendarMonth(month,delta) {
if(!/^\d{4}-(0[1-9]|1[0-2])$/.test(month) || !Number.isInteger(delta))return null;
const [year,m]=month.split('-').map(Number),index=year*12+m-1+delta;
const nextYear=Math.floor(index/12),nextMonth=index%12+1;
if(nextYear<1 || nextYear>9999)return null;
return `${String(nextYear).padStart(4,'0')}-${String(nextMonth).padStart(2,'0')}`;
}