easter-date
Version:
Calculate the date of Easter for a given year
21 lines (20 loc) • 589 B
JavaScript
import { getEaster } from "./easter-sunday.js";
/**
* Returns the date of Good Friday for a given year.
* @param year
*/
export function getGoodFriday(year) {
const date = getEaster(year);
date.setDate(date.getDate() - 2);
return date;
}
/**
* Returns true if the given date is Good Friday.
* @param date
*/
export function isGoodFriday(date) {
const goodFriday = getGoodFriday(date.getFullYear());
return (date.getFullYear() === goodFriday.getFullYear() &&
date.getMonth() === goodFriday.getMonth() &&
date.getDate() === goodFriday.getDate());
}