mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-29 10:09:10 +01:00
fix display_format="hⓂ️s" for r/o only gave one best matching unit (eg. 5m) not all units (eg. 0:05:30)
This commit is contained in:
parent
83cfb34c3c
commit
832725ce52
@ -260,6 +260,16 @@ export class Et2DateDuration extends Et2InputWidget(FormControlMixin(LitElement)
|
||||
this.formatter = formatDuration;
|
||||
}
|
||||
|
||||
transformAttributes(attrs)
|
||||
{
|
||||
// Clean formats
|
||||
if (typeof attrs.display_format === 'string')
|
||||
{
|
||||
attrs.display_format = attrs.display_format.replace(/[^dhms]/g,'');
|
||||
}
|
||||
super.transformAttributes(attrs);
|
||||
}
|
||||
|
||||
get value() : string
|
||||
{
|
||||
let value = 0;
|
||||
|
@ -32,6 +32,14 @@ export class Et2DateDurationReadonly extends Et2DateDuration
|
||||
];
|
||||
}
|
||||
|
||||
constructor()
|
||||
{
|
||||
super();
|
||||
|
||||
// Property defaults
|
||||
this.select_unit = false; // otherwise just best matching unit will be used for eg. display_format "h:m:s"
|
||||
}
|
||||
|
||||
get value()
|
||||
{
|
||||
return this.__value;
|
||||
|
@ -767,7 +767,7 @@ export class et2_date_duration extends et2_date
|
||||
}
|
||||
|
||||
// Clean formats
|
||||
this.options.display_format = this.options.display_format.replace(/[^dhms]/,'');
|
||||
this.options.display_format = this.options.display_format.replace(/[^dhms]/g,'');
|
||||
if(!this.options.display_format)
|
||||
{
|
||||
// @ts-ignore
|
||||
@ -1813,4 +1813,4 @@ export class et2_date_range extends et2_inputWidget
|
||||
*/
|
||||
];
|
||||
}
|
||||
et2_register_widget(et2_date_range, ["date-range"]);
|
||||
et2_register_widget(et2_date_range, ["date-range"]);
|
Loading…
Reference in New Issue
Block a user