Skip to content

chopZonedMilliseconds

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

Returns the zoned datetime string rounded/truncated to second precision.

  • Removes millisecond precision.
  • Returns “” for invalid input.
Parameter Type Description
value string ISO 8601 zoned datetime string

Zoned datetime string without milliseconds or “” for invalid

chopZonedMilliseconds("2024-02-29T14:30:45.123-05:00[America/New_York]") // "2024-02-29T14:30:45-05:00[America/New_York]"
chopZonedMilliseconds("invalid") // ""

zoned/chop/chopZonedMilliseconds.ts