Open mootari opened 1 year ago
Workaround:
function datetimeInput({step, value, ...options} = {}) {
const form = Inputs.datetime({value, ...options});
if(step == null) return form;
form.date.step = step;
if(value != null) {
value = new Date(value);
form.date.value = (new Date(+value - value.getTimezoneOffset() * 1000 * 60)).toISOString().slice(0, 19);
form.date.dispatchEvent(new Event("input"));
}
return form;
}
Inputs of type
datetime-local
may specify astep
attribute to set the input's granularity. The attribute value defaults to "60" but can be set to "1" to allow entering seconds.Passing
step
in theInputs.datetime()
options does not change the input's granularity. Instead, the step attribute has to be applied after the input was created.