Keep default Writer target in the next local month
This commit is contained in:
parent
f8914c364c
commit
e086250a9d
@ -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('-');
|
||||
}
|
||||
})();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user