isValidFiscalPattern
Signature
Section titled “Signature”isValidFiscalPattern(pattern: unknown): pattern is FiscalPatternReturn 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, useisValidFiscalCalendar.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
pattern | unknown | candidate value of any type |
Returns
Section titled “Returns”boolean indicating validity
Related types
Section titled “Related types”Examples
Section titled “Examples”import { isValidFiscalPattern } from "@northguild/gmt/calendar/validate";
isValidFiscalPattern("4-5-4") // trueSource
Section titled “Source”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.