isValidDateCycleField
Signature
Section titled “Signature”isValidDateCycleField(field: unknown): field is DateCycleFieldReturn 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.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
field | unknown | candidate value of any type |
Returns
Section titled “Returns”boolean indicating validity
Related types
Section titled “Related types”Examples
Section titled “Examples”import { isValidDateCycleField } from "@northguild/gmt/plain/validate";
isValidDateCycleField("year") // true