Skip to content

chopMilliseconds

  • The core functions, which every industry uses.
chopMilliseconds(value: string): string

Return a string with millisecond precision removed from a PlainDateTime or PlainTime value.

  • Truncates to second precision.
  • Accepts both PlainDateTime and PlainTime formats.
  • Returns "" for invalid input.
ParameterTypeDescription
valuestringISO PlainDateTime or PlainTime string

ISO string without milliseconds, or "" on invalid input

import { chopMilliseconds } from "@northguild/gmt/plain/chop";
chopMilliseconds("2024-02-29T12:34:56.789") // "2024-02-29T12:34:56"
output 

plain/chop/chopMilliseconds.ts

Accessibility
© 2026 NorthGuild · Licences

Code examples: MIT-0. Packages: MIT. Third-party data and components: their own licences, credited where they appear. Everything else: © 2026 NorthGuild, all rights reserved.