format decimals

This commit is contained in:
liangping 2023-06-20 19:45:49 +08:00
parent 1ee46ad93b
commit 965bb883f5

View File

@ -113,10 +113,10 @@ export function formatSeconds(value?: string) {
if(!value) return ''
const duration = Number(value.replace(/s/, ''))
if(duration > 24*60*60) {
return `${duration / ( 24 * 60 * 60)} days`
return `${(duration / ( 24 * 60 * 60)).toFixed()} days`
}
if(duration > 60*60) {
return `${duration / (60 * 60)} hours`
return `${duration / (60 * 60).toFixed()} hours`
}
if(duration > 60) {
return `${duration / 60} mins`