parseYearFromDateTime
Signature
Section titled “Signature”parseYearFromDateTime(value: string): stringReturn the year for a given ISO 8601 datetime string.
- Returns the year as Temporal writes it: four digits (
"2024","0005"), or a sign and six digits outside 0000–9999 ("+010000","-000005"). - Returns "" for invalid input.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value | string | ISO datetime string |
Returns
Section titled “Returns”the year as four digits, or a sign and six digits outside 0000–9999, or "" on invalid input
Examples
Section titled “Examples”import { parseYearFromDateTime } from "@northguild/gmt/plain/parse";
parseYearFromDateTime("2024-03-15T12:30:00") // "2024"