Skip to content

plainTime

  • The core functions, which every industry uses.
const plainTime: RegExp = /^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:[.,][0-9]{1,9})?)?$/;

RegExp matching ISO 8601 local time (extended): HH:mm[:ss[.fffffffff]].

import { plainTime } from "@northguild/gmt";
plainTime.test("14:30") // true
plainTime.test("14:30:00") // true
plainTime.test("14:30:00.123") // true (fractional seconds)
plainTime.test("14:30:00,123") // true (comma separator)
plainTime.test("24:00:00") // false (hour out of range)
plainTime.exec("14:30:45.5")?.slice(1) // ["14"] (hour)
plainTime.test("14:30:60") // false (leap second; GMT rejects it)

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