cyp/app/js/lib/format.js

13 lines
310 B
JavaScript
Raw Normal View History

2019-03-22 22:35:04 +08:00
export function time(sec) {
sec = Math.round(sec);
let m = Math.floor(sec / 60);
let s = sec % 60;
return `${m}:${s.toString().padStart(2, "0")}`;
}
2019-03-22 23:17:10 +08:00
export function artistAlbum(artist, album) {
let tokens = [];
artist && tokens.push(artist);
album && tokens.push(album);
return tokens.join(" ");
}