UNPKG

@northguild/gmt

Version:

Date and time library for JavaScript and TypeScript, built on TC39 Temporal: time zones, DST, business days, ISO 8601 strings in and out. Never throws.

16 lines (15 loc) • 548 B
// src/internal/isYearMonthDurationUnit.ts /** * Whether `unit` is a duration unit a year-month takes: `"years"` or `"months"`. This is the set * AddDurationToYearMonth leaves after it rejects nonzero weeks, days and time units. * * @param unit the candidate key * @returns whether it is `"years"` or `"months"` * * @example isYearMonthDurationUnit("months") // true * @example isYearMonthDurationUnit("days") // false */ function isYearMonthDurationUnit(unit) { return unit === "years" || unit === "months"; } export { isYearMonthDurationUnit };