From 790b5a341ece453ace4ea545999f754a7669f2e7 Mon Sep 17 00:00:00 2001 From: Alex Liu Date: Fri, 8 Dec 2023 00:08:53 +0800 Subject: [PATCH] refactor(noti): use `Date.now()` instead of `new Date().getTime()` (#44) --- packages/core/src/composables/useCreateNoti.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/core/src/composables/useCreateNoti.ts b/packages/core/src/composables/useCreateNoti.ts index e1af71b..4d257f5 100644 --- a/packages/core/src/composables/useCreateNoti.ts +++ b/packages/core/src/composables/useCreateNoti.ts @@ -37,8 +37,7 @@ export function useCreateNoti(options: UseCreateNotiOptions) { function triggerCountDown(target: Notification) { const interval = setInterval(() => { - const now = new Date() - const lastTime = target.timer.endCountDownTimestamp - now.getTime() + const lastTime = target.timer.endCountDownTimestamp - Date.now() if (lastTime > 0) { target.timer.lastTime = lastTime return