mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-12-23 01:24:22 +00:00
91df20be6b
- add filestash workflow Close gh-2221
19 lines
412 B
JavaScript
19 lines
412 B
JavaScript
/**
|
|
* Pretty print a time in milliseconds.
|
|
*/
|
|
export function prettyMs( time ) {
|
|
const minutes = Math.floor( time / 60000 );
|
|
const seconds = Math.floor( time / 1000 );
|
|
const ms = Math.floor( time % 1000 );
|
|
|
|
let prettyTime = `${ ms }ms`;
|
|
if ( seconds > 0 ) {
|
|
prettyTime = `${ seconds }s ${ prettyTime }`;
|
|
}
|
|
if ( minutes > 0 ) {
|
|
prettyTime = `${ minutes }m ${ prettyTime }`;
|
|
}
|
|
|
|
return prettyTime;
|
|
}
|