From 1f5d1eb2210b9b155bc4c74a9b5cb533238aeaee Mon Sep 17 00:00:00 2001 From: surenjun Date: Wed, 8 Jan 2025 18:15:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E5=A4=8D=E5=9B=9B=E5=90=88?= =?UTF-8?q?=E4=B8=80=E7=94=BB=E9=9D=A2=E5=81=B6=E7=8E=B0=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=B8=8D=E5=AF=B9=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/common/utils/tools.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) 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}` } //时间戳转日期