Skip to content

chopTime

chopTime(value: string): string
import { chopTime } from "@northguild/gmt/plain/chop";

Return the PlainDate portion extracted from an ISO PlainDateTime string.

  • Extracts date components from a PlainDateTime.
  • Returns “” for invalid input.
Parameter Type Description
value string ISO PlainDateTime string

ISO PlainDate string or “” on invalid input

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

plain/chop/chopTime.ts