By Hunter Becton on January 21, 2023
const dateDiff = (date1, date2) => Math.abs(new Date(date1) - new Date(date2));
2023-01-21 19:07:38.578106+00 and
2023-01-03 19:07:38.578106+00 would return
Be careful with the arguments that you pass into this function. When possible, use an ISO-8601-compliant date because you will work more reliably across different runtimes.