Skip to content

isValidDateTimeUnit

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

Return true when unit is a valid DateTimeUnit.

  • Valid units are: “year”, “month”, “week”, “day”, “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 { isValidDateTimeUnit } from "@northguild/gmt/plain/validate";
isValidDateTimeUnit("year") // true
output 

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