Skip to content

hour

const hour: RegExp = /^(0[0-9]|1[0-9]|2[0-3])$/;

RegExp matching an ISO 8601 hour in extended format: 00–23.

import { hour } from "@northguild/gmt";
hour.test("00") // true
hour.test("12") // true
hour.test("23") // true
hour.test("24") // false (out of range)
hour.test("9") // false (not zero-padded)

regex/time.ts