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

Function parseMs

ahooks-hook/src/useCountdown.ts:30–38  ·  view source on GitHub ↗
(milliseconds: number)

Source from the content-addressed store, hash-verified

28};
29
30const parseMs = (milliseconds: number): FormattedRes => {
31 return {
32 days: Math.floor(milliseconds / 86400000),
33 hours: Math.floor(milliseconds / 3600000) % 24,
34 minutes: Math.floor(milliseconds / 60000) % 60,
35 seconds: Math.floor(milliseconds / 1000) % 60,
36 milliseconds: Math.floor(milliseconds) % 1000,
37 };
38};
39
40const useCountdown = (options: Options = {}) => {
41 const { leftTime, targetDate, interval = 1000, onEnd } = options || {};

Callers 1

useCountdownFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected