Skip to content

nanosecondDecimal

  • The core functions, which every industry uses.
const nanosecondDecimal: RegExp = /^-?(?:0|[1-9][0-9]*)$/;

RegExp matching the canonical decimal form of a nanosecond timestamp — the shape formatNanoseconds emits and parseNanoseconds accepts.

import { nanosecondDecimal } from "@northguild/gmt";
nanosecondDecimal.test("1710072000123456789") // true
nanosecondDecimal.test("-1000000000") // true
nanosecondDecimal.test("0") // true
nanosecondDecimal.test("01") // false (leading zero)
nanosecondDecimal.test("1.5") // false
nanosecondDecimal.test("1e18") // false

regex/nanoseconds.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.