tguard-js
    Preparing search index...

    Function isDate

    • Determines whether the provided value is a Date object.

      Parameters

      • x: unknown

        The value to be checked.

      Returns x is Date

      true if the value is a Date object, otherwise false.

      This function checks only the type, not the validity of the date. Invalid dates (e.g., new Date('invalid')) still return true. For validating date, use isValidDate.

      Value Result
      new Date() true
      new Date('invalid') true
      '2026-04-10' false
      Date.now() false
      {} false
      null false

      1.0