MCPcopy Create free account
hub / github.com/dailydotdev/apps / getAbsoluteDifferenceInDays

Function getAbsoluteDifferenceInDays

packages/shared/src/features/boost/utils.ts:4–16  ·  view source on GitHub ↗
(
  date1,
  date2,
)

Source from the content-addressed store, hash-verified

2import type { differenceInDays } from 'date-fns';
3
4export const getAbsoluteDifferenceInDays: typeof differenceInDays = (
5 date1,
6 date2,
7) => {
8 const day1 = startOfDay(date1);
9 const day2 = startOfDay(date2);
10
11 const timeDiff = Math.abs(day1.getTime() - day2.getTime());
12 const diffInDays = timeDiff / (1000 * 60 * 60 * 24);
13
14 // Round down to the nearest whole number since we want full days
15 return Math.floor(diffInDays);
16};

Callers 4

CampaignListViewFunction · 0.90
getEndsInFunction · 0.90
getRemainingFunction · 0.90
PostAnalyticsPageFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected