MCPcopy Index your code
hub / github.com/MALSync/MALSync / checkForNow

Function checkForNow

src/utils/IntlWrapper.ts:407–419  ·  view source on GitHub ↗
(
  input: number,
  relativeTo: Date | number = Date.now(),
  threshold: DurationFormat = { seconds: 30 },
)

Source from the content-addressed store, hash-verified

405}
406
407export function checkForNow(
408 input: number,
409 relativeTo: Date | number = Date.now(),
410 threshold: DurationFormat = { seconds: 30 },
411): boolean {
412 if (Number.isNaN(input)) return false;
413 const relativeToTs = new Date(relativeTo).getTime();
414 const thresholdTs = IntlDuration.durationToMs(threshold);
415 const diff = Math.abs(input - relativeToTs);
416
417 if (diff > thresholdTs) return false;
418 return true;
419}

Callers 1

isNowMethod · 0.85

Calls 1

durationToMsMethod · 0.80

Tested by

no test coverage detected