@tremendous/help
    Preparing search index...

    Function isValidDate

    • Interim implementation that simply proxies to parseDateInput. Validates whether the provided input is an acceptable Tremendous date input. Accepts numbers (as Unix timestamps in seconds), Date objects, and date strings in "MM/DD/YYYY", "MM-DD-YYYY", "YYYY-MM-DD", "YYYY/MM/DD", "MMM DD, YYYY", or "MMMM DD, YYYY" formats with consistent separators. The function checks for correct format and basic date validity. If this function returns true, it means the date is serializable.

      Parameters

      • input: undefined | null | DateInput

        The date input to validate. Can be a number, Date object, or string.

      Returns boolean

      • true if the input is a valid date input, otherwise false.
      isValidDate(1639939200); // true (valid Unix timestamp)
      isValidDate(new Date()); // true
      isValidDate("12/31/2023"); // true
      isValidDate("01-01-2024"); // true
      isValidDate("2024-01-01"); // true
      isValidDate("Aug 11, 2025"); // true
      isValidDate("August 11, 2025"); // true
      isValidDate("12/31-2023"); // false (inconsistent separators)
      isValidDate("31/02/2021"); // false (invalid date)
      isValidDate("2022"); // false (just the year, invalid date)
      isValidDate(""); // false
      isValidDate("INVALID DATE"); // false