chopSeconds
Signature
Section titled “Signature”chopSeconds(value: string): stringimport { chopSeconds } from "@northguild/gmt/plain/chop";Return an ISO string with second precision removed from a PlainDateTime or PlainTime value.
- Truncates to minute precision.
- Accepts both PlainDateTime and PlainTime formats.
- Returns “” for invalid input.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value |
string |
ISO PlainDateTime or PlainTime string |
Returns
Section titled “Returns”ISO string trimmed to minutes or “” on invalid input
Examples
Section titled “Examples”chopSeconds("2024-02-29T12:34:56") // "2024-02-29T12:34"chopSeconds("12:34:56") // "12:34"chopSeconds("invalid") // ""