Mount-Skete / julian-calendar-js

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.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Julian calendar

ru

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.

Node CI CodeQL

Install

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

API

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

Test

npm test

License

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.

About

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.

License:MIT License


Languages

Language:JavaScript 100.0%