diff --git a/entry/src/main/ets/common/utils/tools.ts b/entry/src/main/ets/common/utils/tools.ts index 3cb6dad8..df11e338 100644 --- a/entry/src/main/ets/common/utils/tools.ts +++ b/entry/src/main/ets/common/utils/tools.ts @@ -119,12 +119,16 @@ export async function getCurrentHourTime():Promise { //@ts-ignore s = s < 10 ? '0' + s : s; let ss = date.getMilliseconds(); - //@ts-ignore - ss = ss < 10 ? '00' + ss : ss; - //@ts-ignore - ss = ss < 100 ? '0' + ss : ss; - - return `${h}${m}${s}${ss}` + let nowSS = '' + if(ss < 10){ + //@ts-ignore + nowSS = '00' + ss + } + if(ss >= 10 && ss < 100){ + //@ts-ignore + nowSS = '0' + s + } + return `${h}${m}${s}${nowSS||ss}` } //时间戳转日期