web/elements: add support for datetime-local

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-08-25 21:14:25 +02:00
parent d79975c409
commit 8022d0801d
2 changed files with 3 additions and 1 deletions

View file

@ -136,6 +136,8 @@ export class Form<T> extends LitElement {
json[element.name] = values; json[element.name] = values;
} else if (element.tagName.toLowerCase() === "input" && element.type === "date") { } else if (element.tagName.toLowerCase() === "input" && element.type === "date") {
json[element.name] = element.valueAsDate; json[element.name] = element.valueAsDate;
} else if (element.tagName.toLowerCase() === "input" && element.type === "datetime-local") {
json[element.name] = new Date(element.valueAsNumber);
} else if (element.tagName.toLowerCase() === "input" && element.type === "checkbox") { } else if (element.tagName.toLowerCase() === "input" && element.type === "checkbox") {
json[element.name] = element.checked; json[element.name] = element.checked;
} else { } else {

View file

@ -223,7 +223,7 @@ export class PlexSourceForm extends ModelForm<PlexSource, string> {
> >
<input <input
type="text" type="text"
value="${first(this.instance?.clientId)}" value="${first(this.instance?.clientId, "")}"
class="pf-c-form-control" class="pf-c-form-control"
required required
/> />