From e086250a9d91889cf9eb40300e97866b229c534c Mon Sep 17 00:00:00 2001 From: PlotDirector Application Worker Date: Sun, 6 Dec 2026 08:06:57 +0000 Subject: [PATCH] Keep default Writer target in the next local month --- PlotLine/wwwroot/js/writer-schedule-date.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/PlotLine/wwwroot/js/writer-schedule-date.js b/PlotLine/wwwroot/js/writer-schedule-date.js index 298ad63d..8f3dfe3c 100644 --- a/PlotLine/wwwroot/js/writer-schedule-date.js +++ b/PlotLine/wwwroot/js/writer-schedule-date.js @@ -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('-'); } })();