From 5e0ce1cffaf110ea123f281a92e219901b18474c Mon Sep 17 00:00:00 2001 From: Michael407-maker <58307754+Michael407-maker@users.noreply.github.com> Date: Sat, 7 Oct 2023 15:41:12 -0400 Subject: [PATCH] Time is Up Function --- src/pages/index.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pages/index.tsx b/src/pages/index.tsx index c038a46..dffc1c5 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -25,7 +25,11 @@ const Home: NextPage = ({ judgingDeadline }) => { useEffect(() => { const intervalId = setInterval(() => { const diff = JUDGING_DEADLINE.diffNow(); - setTimeLeft(diff.toFormat("hh:mm:ss")); + if (diff.toMillis() <= 0) { + setTimeLeft("Time is Up!"); + }else{ + setTimeLeft(diff.toFormat("hh:mm:ss")); + } }, 1000); return () => clearInterval(intervalId);