mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
bug fix
This commit is contained in:
1 parent
2b6a510c1e
commit
f2bcc3bc93
23 files changed
+241
-119
No files matched your search
+11
-2
@@ -49,9 +49,18 @@ function size(s, base = 1) {
|
||||
return '{0} {1}'.format(Math.round(s * unit), unitNames[unitNames.length - 1]);
|
||||
}
|
||||
|
||||
function formatSeconds(seconds) {
|
||||
function _digit2(number) {
|
||||
if (number < 10) return `0${number}`;
|
||||
return number.toString();
|
||||
}
|
||||
|
||||
function formatSeconds(seconds = 0) {
|
||||
seconds = parseInt(seconds);
|
||||
return '{:02}:{:02}:{:02}'.format(Math.floor(seconds / 3600), Math.floor((seconds % 3600) / 60), seconds % 60);
|
||||
return '{0}:{1}:{2}'.format(
|
||||
_digit2(Math.floor(seconds / 3600)),
|
||||
_digit2(Math.floor((seconds % 3600) / 60)),
|
||||
_digit2(seconds % 60),
|
||||
);
|
||||
}
|
||||
|
||||
global.Hydro.lib.misc = module.exports = {
|
||||
|
||||
Reference in new issue
Block a user