Skip to content

chopSeconds

chopSeconds(value: string): string
import { 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.
Parameter Type Description
value string ISO PlainDateTime or PlainTime string

ISO string trimmed to minutes or “” on invalid input

chopSeconds("2024-02-29T12:34:56") // "2024-02-29T12:34"
chopSeconds("12:34:56") // "12:34"
chopSeconds("invalid") // ""

plain/chop/chopSeconds.ts