( date1, date2, )
| 2 | import type { differenceInDays } from 'date-fns'; |
| 3 | |
| 4 | export 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 | }; |
no outgoing calls
no test coverage detected