tguard-js
    Preparing search index...

    Function isISODateString

    • Determines whether the provided value is a valid ISO 8601 date string.

      Parameters

      • x: unknown

        The value to be checked.

      • Optionalstrict: boolean

      Returns x is string

      true if the value is a valid ISO date string, otherwise false.

      This function checks:

      1. The value is a string
      2. The string matches a simplified ISO 8601 format (only if strict is set to false)
        • YYYY-MM-DDT (acceptable if strict is set to false)
        • YYYY-MM-DDTHH:mm:ss.sssZ
        • YYYY-MM-DDTHH:mm:ss.sss+HH:mm
      Value Result Default Result Strict Mode
      '2026-04-10T12:00:00Z' true true
      '2026-04-10T12:00:00+07:00' true true
      '2026-04-10T-foo' true false
      '2026-04-10T' true false
      '2026-04-10' false false
      'invalid-date' false false
      new Date().toISOString() true true
      123 false false

      1.0