isValidSqlOffsetDateTime
Signature
Section titled “Signature”isValidSqlOffsetDateTime(value: string): booleanisValidSqlOffsetDateTime(value: void | {} | null | undefined): booleanisValidSqlOffsetDateTime(value: unknown): value is stringReturn true when value is SQL TIMESTAMP WITH TIME ZONE text: SQL-92’s YYYY-MM-DD HH:MM:SS±HH:MM, or a variant PostgreSQL timestamptz, SQL Server datetimeoffset or Oracle under an ISO NLS_TIMESTAMP_TZ_FORMAT print.
- True exactly when
parseSqlOffsetDateTimereturns a non-empty string for the same value. Both read through one core, so they cannot disagree. - Grammar: SQL-92 §5.3
<timestamp string>and<time zone interval>, assqlOffsetDateTimematches: a single space separator, a four-digit year0001–9999, two-digit month, day, hour, minute and second (seconds are required), an optional.followed by up to 9 fraction digits, then an offset±HH,±HH:MMor±HH:MM:SS(PostgreSQL’s hour-only and seconds forms), with one optional space before it (SQL Server and Oracle). Offset hours00–23are GMT’s rule, wider than SQL-92 (§5.3 Syntax Rule 25: −12:59 … +13:00), so that+14:00(SQL Server, MySQL, Oracle) is read; 24 and above is outside Temporal’s offset grammar. - Checks the calendar as well as the shape.
sqlOffsetDateTimematches 30 February; this returns false for it. - False for:
- a second of 60;
- a
Tseparator or aZ, whichisValidInstantandisValidRfc3339DateTimecover; - text with no offset, which
isValidSqlDateTimecovers. - A value that is not a string, a
Stringobject included, returnsfalse. Atrueresult narrows anunknownvalue tostring.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value | string | any value; a string is checked as a SQL offset timestamp literal |
Returns
Section titled “Returns”boolean indicating validity
Examples
Section titled “Examples”import { isValidSqlOffsetDateTime } from "@northguild/gmt/instant/validate";
isValidSqlOffsetDateTime("2024-03-15 14:30:00+00") // trueSource
Section titled “Source”© 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.