Default datetime inputs to current date/time

This commit is contained in:
jude 2023-08-01 17:51:29 +01:00
parent 229ada83e1
commit dc5e52d9ce
2 changed files with 8 additions and 1 deletions

View File

@ -1033,3 +1033,10 @@ document.addEventListener("click", (ev) => {
inlined == "1" ? "0" : "1"; inlined == "1" ? "0" : "1";
} }
}); });
document.addEventListener("DOMContentLoaded", () => {
let now = new Date();
document.querySelectorAll(".prefill-now").forEach((el) => {
el.value = now.toFormat("yyyy-LL-dd'T'HH:mm:ss");
});
});

View File

@ -155,7 +155,7 @@
<div class="control"> <div class="control">
<label class="label collapses"> <label class="label collapses">
Time* Time*
<input class="input" type="datetime-local" step="1" name="time"> <input class="input prefill-now" type="datetime-local" step="1" name="time">
</label> </label>
</div> </div>
</div> </div>