Skip to content

isValidTimeUnit

  • The core functions, which every industry uses.
isValidTimeUnit(unit: unknown): unit is TimeUnit

Return true when unit is a valid TimeUnit.

  • Valid units are: “hour”, “minute”, “second”, “millisecond”, “microsecond”, “nanosecond”.
  • Accepts any input type and returns false for non-string values.
  • Uses type assertion to narrow the type.
ParameterTypeDescription
unitunknowncandidate value of any type

boolean indicating validity

import { isValidTimeUnit } from "@northguild/gmt/plain/validate";
isValidTimeUnit("hour") // true
output 

plain/validate/isValidTimeUnit.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.