Skip to content

isValidFiscalPattern

  • The core functions, which every industry uses.
isValidFiscalPattern(pattern: unknown): pattern is FiscalPattern

Return true when pattern is a valid FiscalPattern.

  • Valid patterns are: “4-5-4”, “4-4-5”, “5-4-4”. One published 4-5-4 example is the NRF retail calendar (US).
  • Accepts any input type and returns false for non-string values.
  • Uses type assertion to narrow the type.
  • A pattern read from config, an env var or a form is a bare string until something narrows it. Narrow it here; to check a whole calendar before getFiscalPeriod, whose null also means an invalid date, use isValidFiscalCalendar.
ParameterTypeDescription
patternunknowncandidate value of any type

boolean indicating validity

import { isValidFiscalPattern } from "@northguild/gmt/calendar/validate";
isValidFiscalPattern("4-5-4") // true
output 

calendar/validate/isValidFiscalPattern.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.