From bb67507223002ad9bbc3237bfd379ed0c59f6fd6 Mon Sep 17 00:00:00 2001 From: nathan Date: Mon, 6 Mar 2023 15:02:45 -0700 Subject: [PATCH] Et2DateDuration: Don't error & break everything for a bad display format, just log it and continue --- api/js/etemplate/Et2Date/Et2DateDuration.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/api/js/etemplate/Et2Date/Et2DateDuration.ts b/api/js/etemplate/Et2Date/Et2DateDuration.ts index 6cd0676510..459a8d3153 100644 --- a/api/js/etemplate/Et2Date/Et2DateDuration.ts +++ b/api/js/etemplate/Et2Date/Et2DateDuration.ts @@ -352,6 +352,12 @@ export class Et2DateDuration extends Et2InputWidget(FormControlMixin(LitElement) set displayFormat(value : string) { this.__displayFormat = ""; + if(!value) + { + // Don't allow an empty value, but don't throw a real error + console.warn("Invalid displayFormat ", value, this); + value = "dhm"; + } // Display format must be in decreasing size order (dhms) or the calculations // don't work out nicely for(let f of Object.keys(Et2DateDuration.time_formats))