forked from extern/egroupware
Et2DateDuration: Enforce the order of display to be greatest to least
For example hours:days is not allowed anymore, auto-corrected to days:hours
This commit is contained in:
parent
22c8d8808f
commit
c12d4cebfb
@ -338,6 +338,30 @@ export class Et2DateDuration extends Et2InputWidget(FormControlMixin(LitElement)
|
|||||||
this.requestUpdate();
|
this.requestUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the format for displaying the duration
|
||||||
|
*
|
||||||
|
* @param {string} value
|
||||||
|
*/
|
||||||
|
set display_format(value : string)
|
||||||
|
{
|
||||||
|
this.__display_format = "";
|
||||||
|
// 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))
|
||||||
|
{
|
||||||
|
if(value.indexOf(f) !== -1)
|
||||||
|
{
|
||||||
|
this.__display_format += f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
get display_format()
|
||||||
|
{
|
||||||
|
return this.__display_format;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {TemplateResult}
|
* @return {TemplateResult}
|
||||||
* @protected
|
* @protected
|
||||||
|
Loading…
Reference in New Issue
Block a user