chopUtc
Signature
Section titled “Signature”chopUtc(value: string): stringReturn the UTC datetime string with a trailing Z removed if present.
- Removes the trailing “Z”; a lower-case “z” is not a GMT UTC string (
isValidUtc), so it returns "". - Drops the RFC 9557 annotations
Temporal.Instant.fromignores ([foo=bar],[Europe/Paris]). - 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”import { chopUtc } from "@northguild/gmt/utc/chop";
chopUtc("2024-03-10T12:00:00Z") // "2024-03-10T12:00:00"