chopUtc
Signature
Section titled “Signature”chopUtc(value: string): stringimport { chopUtc } from "@northguild/gmt/utc/chop";Return the UTC datetime string with a trailing Z removed if present.
- Uses regex to remove trailing “z” or “Z”.
- Returns “” for invalid input.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value |
string |
UTC datetime string (ISO 8601) |
Returns
Section titled “Returns”UTC datetime string without trailing Z or “” on invalid input
Examples
Section titled “Examples”chopUtc("2024-03-10T12:00:00Z") // "2024-03-10T12:00:00"chopUtc("2024-03-10T12:00:00") // "2024-03-10T12:00:00"chopUtc("invalid") // ""