Checks if a date is before another date.

isDateBefore('2020-01-01', '2021-01-01'); // true
isDateBefore('2021-01-01', '2020-01-01'); // false
  • Parameters

    • date: string | number | Date

      The date to check.

    • dateToCompare: string | number | Date

      The date to compare against.

    Returns boolean

    true if the date is before the date to compare, otherwise false.