Et2DateDuration: Don't error & break everything for a bad display format, just log it and continue

This commit is contained in:
nathan 2023-03-06 15:02:45 -07:00
parent 1538496df1
commit bb67507223

View File

@ -352,6 +352,12 @@ export class Et2DateDuration extends Et2InputWidget(FormControlMixin(LitElement)
set displayFormat(value : string) set displayFormat(value : string)
{ {
this.__displayFormat = ""; 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 // Display format must be in decreasing size order (dhms) or the calculations
// don't work out nicely // don't work out nicely
for(let f of Object.keys(Et2DateDuration.time_formats)) for(let f of Object.keys(Et2DateDuration.time_formats))