Skip to content

chopUtc

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

Return the UTC datetime string with a trailing Z removed if present.

  • Removes the trailing “Z”; a lower-case “z” is not a GMT UTC string (isValidUtc), so it returns "".
  • Returns "" for a string with any annotation ([foo=bar], [u-ca=iso8601], [Europe/Paris]): a UTC string is …Z and nothing after.
  • Returns "" for invalid input.
ParameterTypeDescription
valuestringUTC datetime string (ISO 8601)

UTC datetime string without trailing Z or "" on invalid input

import { chopUtc } from "@northguild/gmt/utc/chop";
chopUtc("2024-03-10T12:00:00Z") // "2024-03-10T12:00:00"
output 

utc/chop/chopUtc.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.