fiddle with the fuzzy time some more

This commit is contained in:
codl 2017-08-31 21:13:41 +02:00
parent 3d303a3cf5
commit 278c5b9e2b
No known key found for this signature in database
GPG Key ID: 6CD7C8891ED1233A
1 changed files with 6 additions and 6 deletions

View File

@ -76,12 +76,12 @@ function s(n){
return '';
}
function rel(millis){
let secs = Math.floor(millis/1000)
if(secs < 120){
let secs = Math.round(millis/1000)
if(secs <= 120){
return `${secs} seconds`;
}
let mins = Math.floor(secs/60);
if(mins < 60){
let mins = Math.round(secs/60);
if(mins <= 60){
return `${mins} minute${s(mins)}`;
}
let hours = Math.floor(mins/60);
@ -89,10 +89,10 @@ function rel(millis){
if(hours < 6){
return `${hours}h ${mins}m`;
}
if(hours < 48){
if(hours <= 48){
return `${hours} hour${s(hours)}`;
}
let days = Math.floor(hours/24);
let days = Math.round(hours/24);
return `${days} days`;
}