From b06705d583ea9c7556521fa61bf13b9a7805bd39 Mon Sep 17 00:00:00 2001 From: Vince Au Date: Thu, 15 Feb 2024 10:08:48 +1100 Subject: [PATCH] remove seconds from countdown --- src/renderer/pages/home/sidebar/slippi_store.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/renderer/pages/home/sidebar/slippi_store.tsx b/src/renderer/pages/home/sidebar/slippi_store.tsx index 655d17607..cdc2d3a50 100644 --- a/src/renderer/pages/home/sidebar/slippi_store.tsx +++ b/src/renderer/pages/home/sidebar/slippi_store.tsx @@ -80,7 +80,7 @@ export const SlippiStore = React.memo(function SlippiStore() { React.useEffect(() => { const endDate = SHOP_CLOSES_AT; - const interval = setInterval(() => { + const checkTime = () => { const now = new Date(); const duration = intervalToDuration({ start: now, end: endDate }); @@ -89,10 +89,12 @@ export const SlippiStore = React.memo(function SlippiStore() { setCountdown(""); clearInterval(interval); } else { - setCountdown(formatDuration(duration, { locale: shortEnLocale })); + setCountdown(formatDuration(duration, { format: ["days", "hours", "minutes"], locale: shortEnLocale })); } - }, 1000); + }; + checkTime(); + const interval = setInterval(checkTime, 60 * 1000); return () => clearInterval(interval); }, []);