parseYearFromUtc
Signature
Section titled “Signature”parseYearFromUtc(value: string): stringimport { parseYearFromUtc } from "@northguild/gmt/utc/parse";Return the year from a UTC datetime string.
- Returns the year as a string (e.g., “2024”).
- Returns “” for invalid input.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value |
string |
ISO UTC datetime string (e.g., “2024-03-17T14:30:45Z”) |
Returns
Section titled “Returns”Year (YYYY) or “” on invalid input
Examples
Section titled “Examples”parseYearFromUtc("2024-03-17T14:30:45Z") // "2024"parseYearFromUtc("invalid") // ""