Imports name this capability’s declared dependencies, which fune builds next to it in your project; each one links to its page.
import { isLeapYear as kernelIsLeapYear } from "./dates_add_days.ts"; ← from dates.add-days ^1.0.0 · built alongside by fune
/**
* Whether a year is a Gregorian leap year. The rule lives in dates.add-days;
* this adds the range check so a year of 0 or 10000 fails loudly rather than
* answering for a year no ISO date can name.
*/
export function isLeapYear(year: number): boolean {
if (!Number.isInteger(year)) {
throw new TypeError(`year must be an integer, received ${year}`);
}
if (year < 1 || year > 9999) {
throw new RangeError(`year ${year} is outside the supported range 1 to 9999`);
}
return kernelIsLeapYear(year);
}