Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
date-easter
Advanced tools
The date-easter npm package is designed to calculate the date of Easter for a given year. It provides functionality to determine the date of Easter Sunday based on different calendar systems, such as the Gregorian and Julian calendars.
Calculate Easter Date (Gregorian Calendar)
This feature allows you to calculate the date of Easter Sunday for a given year using the Gregorian calendar. The code sample demonstrates how to use the `gregorianEaster` function to get the date of Easter in 2023.
const easter = require('date-easter');
const year = 2023;
const easterDate = easter.gregorianEaster(year);
console.log(`Easter in ${year} is on: ${easterDate}`);
Calculate Easter Date (Julian Calendar)
This feature allows you to calculate the date of Easter Sunday for a given year using the Julian calendar. The code sample demonstrates how to use the `julianEaster` function to get the date of Easter in 2023 according to the Julian calendar.
const easter = require('date-easter');
const year = 2023;
const easterDate = easter.julianEaster(year);
console.log(`Easter in ${year} (Julian) is on: ${easterDate}`);
date-fns is a comprehensive library for working with dates in JavaScript. While it does not specifically focus on calculating Easter dates, it provides a wide range of utilities for date manipulation and formatting. It can be used in conjunction with custom logic to calculate Easter dates.
Moment.js is a popular library for parsing, validating, manipulating, and formatting dates in JavaScript. Similar to date-fns, it does not have built-in functionality for calculating Easter dates but offers extensive date manipulation capabilities that can be used to implement such calculations.
easter-date is another npm package specifically designed to calculate the date of Easter Sunday. It provides similar functionality to date-easter, allowing users to determine the date of Easter for a given year using both the Gregorian and Julian calendars.
Calculates Easter for a given year
// ES5
import {easter, gregorianEaster, julianEaster, orthodoxEaster} from 'date-easter'
// cjs
const {easter, gregorianEaster, julianEaster, orthodoxEaster} = require('date-easter')
easter(2016)
// { year: 2016, month: 3, day: 27 }
gregorianEaster(new Date('2016-01-01'))
// { year: 2016, month: 3, day: 27 }
julianEaster(2016)
// { year: 2016, month: 4, day: 18 }
orthodoxEaster(2016)
// { year: 2016, month: 5, day: 1 }
All methods return an object with the following properties
YYYY-MM-DD
Shortcut for gregorianEaster
.
Returns the date of Gregorian Easter for a given year. Uses the extended Gaussian Easter algorithm.
Returns the date of Julian Easter for a given year in the Julian Calender
Returns the date of Julian Easter for a given year in the Gregorian Calender
Copyright (c) 2015 commenthol
Software is released under MIT.
FAQs
Calculates Easter for a given year
The npm package date-easter receives a total of 149,266 weekly downloads. As such, date-easter popularity was classified as popular.
We found that date-easter demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.