Skip to content

isValidRfc3339DateTime

  • The core functions, which every industry uses.
isValidRfc3339DateTime(value: string): boolean
isValidRfc3339DateTime(value: void | {} | null | undefined): boolean
isValidRfc3339DateTime(value: unknown): value is string

Return true when value is a real RFC 3339 date-time: an ISO 8601 date and time that always states its UTC offset, as Z or ±HH:MM (RFC 3339 §5.6).

  • True exactly when parseRfc3339 returns a zoned string for the same value: the validator calls the parser, so the two cannot disagree.
  • Checks the calendar as well as the shape. The rfc3339DateTime pattern proves the shape alone, so it matches a day that does not exist: 29 February in a common year and 31 June are false here.
  • Accepts T, t or a single space between the date and the time, Z or z, a numeric offset from -23:59 to +23:59, and up to nine fraction digits.
  • False for a leap second (:60), although §5.6 time-second admits it: GMT rejects leap seconds because Temporal would read one as :59.
  • False for GMT’s own zoned strings, which carry a bracketed zone (...+00:00[UTC]): that annotation is not RFC 3339. Check those with isValidZonedDateTime.
  • A value that is not a string, a String object included, returns false. A true result narrows an unknown value to string.
  • Read the value with parseRfc3339; write one with formatRfc3339.
ParameterTypeDescription
valuestringany value; a string is checked as an RFC 3339 date-time

boolean indicating validity

import { isValidRfc3339DateTime } from "@northguild/gmt/zoned/validate";
isValidRfc3339DateTime("2024-03-15T14:30:00-04:00") // true
output 

zoned/validate/isValidRfc3339DateTime.ts

Accessibility
© 2026 NorthGuild · Licences

Code examples: MIT-0. Packages: MIT. Third-party data and components: their own licences, credited where they appear. Everything else: © 2026 NorthGuild, all rights reserved.