提交修改

This commit is contained in:
daihh
2022-06-07 16:30:28 +08:00
parent 6f015d61e1
commit 870bc1309a
4 changed files with 86 additions and 116 deletions

View File

@@ -3,7 +3,7 @@
// fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length));
// }
// let o = {
// 'M+': new date(date).getMonth() +1,
// 'M+': new date(date).getMonth() +1,
// 'd+': date.getDate(),
// 'h+': date.getHours(),
// 'm+': date.getMinutes(),
@@ -70,11 +70,16 @@ export function formatDate(date){
// 秒转时分秒
export function formatSeconds(value) {
let result = parseInt(value)
let h = Math.floor(result / 3600) < 10 ? '0' + Math.floor(result / 3600) : Math.floor(result / 3600);
let m = Math.floor((result / 60 % 60)) < 10 ? '0' + Math.floor((result / 60 % 60)) : Math.floor((result / 60 % 60));
let s = Math.floor((result % 60)) < 10 ? '0' + Math.floor((result % 60)) : Math.floor((result % 60));
let d= Math.floor(result / (3600*24));
let last=Math.floor(result % (3600*24));
let h = Math.floor(last / 3600) < 10 ? '0' + Math.floor(last / 3600) : Math.floor(last / 3600);
let m = Math.floor((last / 60 % 60)) < 10 ? '0' + Math.floor((last / 60 % 60)) : Math.floor((last / 60 % 60));
let s = Math.floor((last % 60)) < 10 ? '0' + Math.floor((last % 60)) : Math.floor((last % 60));
let res = '';
if(d>0){
res += `${d}`;
}
if(h !== '00'){
res += `${h}小时`;
}