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;
} else if (element.tagName.toLowerCase() === "input" && element.type === "date") {
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") {
json[element.name] = element.checked;
} else {

View File

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