From 8ea903dae727d415a240badab45ed5bf621bd402 Mon Sep 17 00:00:00 2001 From: Shine Li Date: Thu, 19 Dec 2024 09:14:26 +0800 Subject: [PATCH] fix: change session activity to use local date (#2478) --- .../sdk/src/zkEvm/sessionActivity/sessionActivity.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/passport/sdk/src/zkEvm/sessionActivity/sessionActivity.ts b/packages/passport/sdk/src/zkEvm/sessionActivity/sessionActivity.ts index 13e5bde985..87acab55cc 100644 --- a/packages/passport/sdk/src/zkEvm/sessionActivity/sessionActivity.ts +++ b/packages/passport/sdk/src/zkEvm/sessionActivity/sessionActivity.ts @@ -19,8 +19,12 @@ const syncSendCount = () => { sendCount = getItem(SESSION_ACTIVITY_COUNT_KEY) || {}; const sendDay = getItem(SESSION_ACTIVITY_DAY_KEY); - // If no day, set count to zero. If not today, reset sendCount to 0 - const today = new Date().toISOString().split('T')[0]; + // If no day, init sendCount. If not today, reset sendCount + const date = new Date(); + const yyyy = date.getFullYear(); + const mm = `${date.getMonth() + 1}`.padStart(2, '0'); + const dd = `${date.getDate()}`.padStart(2, '0'); + const today = `${yyyy}-${mm}-${dd}`; if (!sendDay || sendDay !== today) { sendCount = {}; }