MCPcopy Create free account
hub / github.com/QuarkGluonPlasma/react-course-code / calcLeft

Function calcLeft

ahooks-hook/src/useCountdown.ts:21–28  ·  view source on GitHub ↗
(target?: TDate)

Source from the content-addressed store, hash-verified

19}
20
21const calcLeft = (target?: TDate) => {
22 if (!target) {
23 return 0;
24 }
25
26 const left = dayjs(target).valueOf() - Date.now();
27 return left < 0 ? 0 : left;
28};
29
30const parseMs = (milliseconds: number): FormattedRes => {
31 return {

Callers 1

useCountdownFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected