Keep default Writer target in the next local month

This commit is contained in:
PlotDirector Application Worker 2026-12-06 08:06:57 +00:00
parent f8914c364c
commit e086250a9d

View File

@ -22,8 +22,10 @@
const deadline = start.form.querySelector('[data-author-target-date]');
if (deadline?.dataset.defaultLocal === 'true') {
now.setMonth(now.getMonth() + 1);
deadline.value = [now.getFullYear(), now.getMonth() + 1, now.getDate()]
const nextMonth = new Date(now.getFullYear(), now.getMonth() + 1, 1);
const lastDay = new Date(now.getFullYear(), now.getMonth() + 2, 0).getDate();
nextMonth.setDate(Math.min(now.getDate(), lastDay));
deadline.value = [nextMonth.getFullYear(), nextMonth.getMonth() + 1, nextMonth.getDate()]
.map(part => String(part).padStart(2, '0')).join('-');
}
})();