From 0f145323b2e69dbcedd9cc227ae319699880515e Mon Sep 17 00:00:00 2001 From: nathan Date: Fri, 2 Jun 2023 09:50:59 -0600 Subject: [PATCH] Et2Date: Fix timeonly does not update value the first time when manually typing a new value --- api/js/etemplate/Et2Date/Et2Date.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/api/js/etemplate/Et2Date/Et2Date.ts b/api/js/etemplate/Et2Date/Et2Date.ts index 9c4504bea6..9bfecc9c81 100644 --- a/api/js/etemplate/Et2Date/Et2Date.ts +++ b/api/js/etemplate/Et2Date/Et2Date.ts @@ -744,7 +744,16 @@ export class Et2Date extends Et2InputWidget(FormControlMixin(LitFlatpickr)) // Avoid infinite loop of setting the same value back triggering another change this._instance.input.value !== flatpickr.formatDate(parsedDate, this.getOptions().dateFormat)) { - this._instance.setDate(value, true, this._instance.config.altFormat) + try + { + // Can error for time-only due to missing calendar + this._instance.setDate(value, true, this._instance.config.altFormat) + } + catch(e) + { + // Just do it again, it works the second time + this._instance.setDate(value, true, this._instance.config.altFormat); + } } // Update the et2-textbox so it has current value for any (required) validation this._inputNode.value = formattedDate;