@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.
31 lines • 1.54 kB
TypeScript
import { EasterComputus } from "../../types/holiday-rule.js";
/**
* Easter Sunday of a year as an ISO date, by the Gregorian computus unless the Julian one is asked for.
*
* - The Gregorian computus (Meeus, *Astronomical Algorithms*, ch. 8) is applied proleptically
* before 1583, because Temporal dates are proleptic Gregorian.
* - The Julian computus gives the Easter of the Julian calendar, returned as an ISO (proleptic
* Gregorian) date. Far from the present its ISO year can differ from `year`: Julian year 33808
* gives `"+033809-01-01"`.
* - Returns `""` when `year` is not an integer, `options` is not an object or `undefined`,
* `options.computus` is neither `"gregorian"` nor `"julian"`, or the date falls outside
* Temporal's range.
*
* @param year integer year; zero and negative years are accepted
* @param options options bag; `undefined` means the defaults
* @returns ISO PlainDate string of Easter Sunday, or "" on invalid input
*
* @example easterSunday(2024) // "2024-03-31"
* @example easterSunday(2024, { computus: "julian" }) // "2024-05-05"
* @example easterSunday(2025, { computus: "julian" }) // "2025-04-20" — the two computus coincide
* @example easterSunday(2024.5) // ""
* @example easterSunday(2024, { computus: "lunar" }) // ""
*/
export declare function easterSunday(year: number, options?: {
/**
* Which computus decides Easter: `"gregorian"` or `"julian"` (the Julian calendar's Easter).
*
* @defaultValue "gregorian"
*/
computus?: EasterComputus;
}): string;