[pve-devel] [PATCH widget-toolkit 4/4] format_duration_human: say <1s instead of 0s

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Jun 15 15:32:33 CEST 2020


Am 6/12/20 um 1:29 PM schrieb Dominik Csapak:
> if we get a duration of <=0s it should actually be somewhere
> betweeen 0 and 1s so return <1s

Hmm, I get where you come from it was initially just as a safe guard and
0s should be understandable as well if start and endtime is shown the same.

If we do this I'd like to handle 0 < values < 0.1 too and either render them as
milliseconds or render them as '<0.1s', useful for use sites other than the task
log. Currently those are "completely" broken, as in returns empty string.

> 
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
>  src/Utils.js | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/Utils.js b/src/Utils.js
> index 2163794..a914795 100644
> --- a/src/Utils.js
> +++ b/src/Utils.js
> @@ -158,7 +158,7 @@ utilities: {
>  	let seconds = 0, minutes = 0, hours = 0, days = 0;
>  
>  	if (ut <= 0) {
> -	    return '0s';
> +	    return '<1s';
>  	}
>  
>  	let remaining = ut;
> 





More information about the pve-devel mailing list