Skip to content

Commit

Permalink
fix(flat-components): ended timer logic error
Browse files Browse the repository at this point in the history
  • Loading branch information
hyrious committed Feb 21, 2024
1 parent f71cc97 commit dc843ca
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const useClockTick = (beginTime: number, expireAt: number | undefined): [TimerSt
return useMemo(() => {
if (beginTime > timestamp) {
return [TimerStatus.Prepare, formatInterval(timestamp, beginTime)];
} else if (expireAt && expireAt - timestamp < 5 * 60_000) {
} else if (expireAt && 0 <= expireAt - timestamp && expireAt - timestamp < 5 * 60_000) {
return [TimerStatus.WillEnd, formatInterval(timestamp, expireAt)];
} else if (expireAt && expireAt < timestamp) {
return [TimerStatus.Ended, formatInterval(expireAt, timestamp)];
Expand Down

0 comments on commit dc843ca

Please sign in to comment.