From be4506fa3bec1a24887be8f6a0992366f7fda49b Mon Sep 17 00:00:00 2001 From: nathan Date: Mon, 20 Mar 2023 10:33:26 -0600 Subject: [PATCH] Fix DateRange UI did not fill in start date properly --- api/js/etemplate/Et2Date/Et2DateRange.ts | 38 ++++-------------------- 1 file changed, 6 insertions(+), 32 deletions(-) diff --git a/api/js/etemplate/Et2Date/Et2DateRange.ts b/api/js/etemplate/Et2Date/Et2DateRange.ts index b373faa82c..765aa7c868 100644 --- a/api/js/etemplate/Et2Date/Et2DateRange.ts +++ b/api/js/etemplate/Et2Date/Et2DateRange.ts @@ -3,9 +3,8 @@ import {FormControlMixin} from "@lion/form-core"; import {classMap, css, html, ifDefined, LitElement, TemplateResult} from "@lion/core"; import shoelace from "../Styles/shoelace"; import {dateStyles} from "./DateStyles"; -import flatpickr from "flatpickr"; import "flatpickr/dist/plugins/rangePlugin"; -import {Et2Date, formatDate, parseDate} from "./Et2Date"; +import {formatDate, parseDate} from "./Et2Date"; import {egw} from "../../jsapi/egw_global"; /** @@ -55,31 +54,6 @@ export class Et2DateRange extends Et2InputWidget(FormControlMixin(LitElement)) super(); } - getUpdateComplete() { - const p = super.getUpdateComplete(); - if(!this.relative) - { - p.then(() => this.setupFlatpickr()); - } - return p; - } - protected setupFlatpickr() - { - if(!this.fromElement || !this.fromElement._inputElement) return; - - this.fromElement._instance = flatpickr((this.fromElement).findInputField(), { - ...(this.fromElement).getOptions(), - ...{ - plugins: [ - // @ts-ignore ts can't find rangePlugin in IDE - rangePlugin({ - input: this.toElement - }) - ] - } - }); - } - render() { const hasLabel = this.label ? true : false @@ -157,15 +131,15 @@ export class Et2DateRange extends Et2InputWidget(FormControlMixin(LitElement)) ?required=${this.required} placeholder=${ifDefined(this.placeholder)} defaultDate=${ifDefined(this.value?.from)} - > - + + > `; }