The project is a collection of functions to convert dates between Gregorian and Julian calendars. Additionally it includes functions to calculate Orthodox and Catholic Easter dates.
npm install @mount-skete/julian-calendar
The package is currently published only to GitHub Packages. You may need to add the following entry to your local or global .npmrc
file.
@mount-skete:registry=https://npm.pkg.github.com
import {
julianToGregorian,
gregorianToJulian,
isLeapJulianYear,
isLeapGregorianYear,
julianToJulianDay,
gregorianToJulianDay,
calculateOrthodoxEasterJulian,
calculateOrthodoxEasterGregorian,
calculateCatholicEasterGregorian,
calculateEchoGregorian
} from '@mount-skete/julian-calendar';
Converts date in Julian calendar to a date in Gregorian calendar.
const feb1 = new Date(Date.UTC(2023, 1, 1));
julianToGregorian(feb1); // '2023-02-14T00:00:00.000Z'
Converts date in Gregorian calendar to a date in Julian calendar.
const feb1 = new Date(Date.UTC(2023, 1, 14));
gregorianToJulian(feb1); // '2023-02-01T00:00:00.000Z'
Is a given year in the Julian calendar a leap year?
isLeapJulianYear(2020); // true
Is a given year in the Gregorian calendar a leap year?
isLeapGregorianYear(2020); // true
Calculates Julian day number from Julian calendar date.
const feb1 = new Date(Date.UTC(2023, 1, 1));
julianToJulianDay(feb1); // 2459989.5
Calculates Julian day number from Gregorian calendar date.
const feb1 = new Date(Date.UTC(2023, 1, 1));
gregorianToJulianDay(feb1); // 2459976.5
Calculates Orthodox Easter date in Julian calendar.
calculateOrthodoxEasterJulian(2023); // '2023-04-03T00:00:00.000Z'
Calculates Orthodox Easter date in Gregorian calendar.
calculateOrthodoxEasterGregorian(2023); // '2023-04-16T00:00:00.000Z'
Calculates Catholic Easter date in Gregorian calendar.
calculateCatholicEasterGregorian(2023); // '2023-04-09T00:00:00.000Z'
Calculates week Echo for a given date in Gregorian calendar.
const feb1 = new Date(Date.UTC(2023, 1, 1));
calculateEchoGregorian(feb1); // 8
npm test
Julian and Gregorian date conversion calculations are based on public domain algorithms from the Fourmilab.
This project is licensed under the MIT License - see the LICENSE file for details.