Skip to content

isValidDateCycleField

  • The core functions, which every industry uses.
isValidDateCycleField(field: unknown): field is DateCycleField

Return true when field is a valid DateCycleField.

  • Valid fields are: “year”, “month”, “day”.
  • Accepts any input type and returns false for non-string values.
  • Note “week” is a valid DateUnit elsewhere in GMT but is NOT a valid cycle field — it isn’t a .with()-settable field, so it can’t be cycled.
ParameterTypeDescription
fieldunknowncandidate value of any type

boolean indicating validity

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

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