Calculates the number of days passed from the given date string to the current date.
The date string to calculate the difference from. The date string should be in a format recognized by the Date constructor.
Date
The number of days passed from the given date to today.
Will throw an error if the date string is in an invalid format.
const days = diffDaysFromNow('2023-01-01');console.log(days); // Outputs the number of days from January 1, 2023 to today Copy
const days = diffDaysFromNow('2023-01-01');console.log(days); // Outputs the number of days from January 1, 2023 to today
Calculates the number of days passed from the given date string to the current date.