Update default attr

Signed-off-by: Avior <florian.bouillon@delta-wings.net>
This commit is contained in:
2019-12-09 14:14:19 +01:00
parent 44762c6e72
commit d648f7990f

View File

@ -36,12 +36,12 @@ extends AbstractAttribute {
return
}
let attrVal = this.input.element.getAttribute("data-default")
let attrVal = this.input.element.getAttribute("data-default") || undefined
// if element has a date,time,week type
let type = this.input.element.getAttribute("type") || ""
if (type === "date" || type === "time" || type === "week") {
this.input.setValue(attrVal !== "" && attrVal !== null ? new Date(attrVal): new Date())
this.input.setValue(attrVal !== "" && attrVal !== undefined ? new Date(attrVal): new Date())
return
}