isValidDateDurationUnit
Signature
Section titled “Signature”isValidDateDurationUnit(unit: unknown): unit is "years" | "months" | "weeks" | "days"Return true when unit is a valid DateDurationUnit.
- Valid units are: “years”, “months”, “weeks”, “days”.
- A value that is not a string, a
Stringobject included, returnsfalse. Atrueresult narrows the value to the unit type.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
unit | unknown | any value; a string is checked against the date duration units |
Returns
Section titled “Returns”boolean indicating whether the unit is valid
Related types
Section titled “Related types”Examples
Section titled “Examples”import { isValidDateDurationUnit } from "@northguild/gmt/plain/validate";
isValidDateDurationUnit("days") // 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.