parseTimeFromUtc
Signature
Section titled “Signature”parseTimeFromUtc(value: string, options?: { timeZone?: string; }): stringimport { parseTimeFromUtc } from "@northguild/gmt/utc/parse";Extract the time portion from a UTC datetime string.
- Uses Temporal.Instant.from to parse, converts to specified timezone.
- Defaults to UTC if no timezone specified.
- Returns “” for invalid input.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value |
string |
ISO UTC datetime string (e.g., “2024-03-17T14:30:45Z”) |
Options
Section titled “Options”options
| Option | Type | Default |
|---|---|---|
timeZone? |
string |
— |
Returns
Section titled “Returns”ISO time string (e.g., “14:30:45”) or “” on invalid input
Examples
Section titled “Examples”parseTimeFromUtc("2024-03-17T14:30:45Z") // "14:30:45"parseTimeFromUtc("2024-03-17T14:30:45Z", { timeZone: "America/New_York" }) // "10:30:45"parseTimeFromUtc("invalid") // ""