isValidUtcTimestamp
Signature
Section titled “Signature”isValidUtcTimestamp(value: string): booleanReturn true when value is a real UTC instant written as YYYY-MM-DDTHH:MM:SS[.f]Z and nothing else: a narrower check than isValidUtc.
- The shape is one spelling of the RFC 3339 §5.6
date-time: a four-digit year,0000to9999(date-fullyear = 4DIGIT), an upper-caseT, a time with seconds, an optional fraction of one to nine digits after a dot (time-secfrac = "." 1*DIGIT; GMT stops at nine because Temporal keeps nanoseconds), and an upper-caseZwith nothing after it. - Use it for a string headed for storage, or for a reader that is not Temporal: the shape is plain RFC 3339, and the one
Temporal.Instant.prototype.toString(), called with no options, writes for years0000to9999. - Use
isValidUtcwhen Temporal is the only reader. It also accepts a time without seconds, a comma before the fraction, an expanded±YYYYYYyear and RFC 9557 annotations; all four are false here. - A subset of
isValidUtc: every string that is true here is true there. The instant is checked as well as the shape, so a day that does not exist is false. - False for the other spellings §5.6 allows: a lower-case
torz, a space forT(its NOTE), and a numeric offset,+00:00included.isValidRfc3339DateTimechecks the whole grammar, with the same two GMT limits. - False for a leap second (
:60), although §5.6time-secondadmits it: GMT rejects leap seconds because Temporal would read one as:59. - Not one canonical spelling:
12:00:00Zand12:00:00.000Zare one instant and both are true. A reader may still refuse or round a string that is true here: PostgreSQL has no year0000and keeps microseconds. SeetoPgMicrosecondsandprecision/. - False for a non-string.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value | string | candidate UTC timestamp string |
Returns
Section titled “Returns”true when value is a real UTC instant in this shape, or false on invalid input
Examples
Section titled “Examples”import { isValidUtcTimestamp } from "@northguild/gmt/utc/validate";
isValidUtcTimestamp("2026-10-06T12:00:00Z") // true