b-angelov / Dynamic-Orthodox-Calendar-Works

Dynamic Orthodox calendar works

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Easter Calendar

Dynamic Orthodox Church Calendar

This repository aims to implement an Orthodox Church's Easter Calendar dynamically updating holidays during the year, according to the rules for their calculation. This project is written in Python 3.

Current files:

  • Easterlib.py
  • orthodox-easter-calculus.py

Easterlib specifications:

*Note: all these descriptions are presently contained in the exemplary orthodox-easter-calculus.py file.
  • Options:

  • ec.mode

    Applies to both calendar (Julian or Gregorian) and algorithm used for Easter's calculus.

    available modes:
      1. "Julian" : Calculates Julian calendar's Easter according to the Meeus's algorithm
      1. "GaussJulian" : Calculates Julian calendar's Easter according to the Gauss' Julian Easter algorithm.
      1. "JulianInGregorian" : Calculates Julian Easter according Meeus' algorithm and aligns it to Gregorian Civil calendar (Suitable for Eastern Orthodox' Easter). Alignment for dates before Gregorian's calendar adoption is done according to adoption year and options set.
      1. "GaussJulianInGregorian" : Same as "JulianInGregorian", with Gauss' Julian algorithm used for calculation instead of Meeus'.
      1. "GaussGregorian" : Calculates Easter's day according to Gregorian calendar, using Gauss algorithm. Dates before Gregorian calendar's adoption are calculated according to the adoption year and options set.
      1. "AnonymousGregorian" : Same as "GaussGregorian", using Anonymous algorithm posted by New York Times correspondent instead.
      1. "AnonymousGregorianOptimized" : Same as "AnonymousGregorian", although New Scientist's optimization from 1961st are included in the algorithm.
      1. Note: all mode names are case insensitive.
  • ec.year the year to check for

  • ec.adoptionYear Set the year since which Gregorian calendar is adopted defaults to 1582 (excluding).

  • ec.adoption Sets adoption mode, available options:

    • "exclusive" : excludes the adoption year itself (default)
    • "inclusive" : includes the year of adoption
  • ec.gregPriorAdoptions Sets whether Gregorian dates should be calculated for years before adoption. (Defaults to False).

    • If false, Julian Gauss dates are being returned instead for any year before adoptions (applies to modes "JulianInGregorian","GaussJulianInGregorian", "GaussGregorian", "AnonymousGregorian", "AnonymousGregorianOptimized")
  • Result variables available:

  • Note: all variables are being set on class initialization. If any option has been changed, ec.set() function must be called in order to update results.
    1. ec.date = [month, day]
      • Returns Easter's day and month list according to provided configuration.
    2. ec.day = int(day)
      • Contains Easter's day in the month number.
    3. ec.month = int(month)
      • Contains the Easter month's number.
    4. ec.leap = bool
      • Contains information whether checked year is a leap year. True means leap, False not leap. The calculation is done according to calendar set (Julian or Gregorian).
    5. ec.year = int(year)
      • The year processed.
  • Method functions available:

    1. ec.set(year = None, mode = None)
      • If any change on configuration options is done, set() function must be called to apply them on the result variables.
    2. ec.JulianCal(year)
      • Returns Easter date's [month, day] list in Julian calendar, using Meeus' algorithm. Year option is required.
    3. ec.JulianInGregorian(month, day, year=None)
      • Aligns Julian dates to Gregorian civil calendar. Dates before Gregorian calendar's adoption are calculated or not according to ec.gregPriorAdoption value. If year is None, the year from class variable ec.year is processed. [month, day] list is returned.
    4. ec.isLeap(year, mode = "Gregorian")
      • Checks whether the year is leap. The mode options might be set to "Julian" or "Gregorian" in order to change leap year algorithm. Bool returned.
    5. ec.GaussAlgorithm(year, mode = "Julian")
      • Processes given year according to Gauss algorithm. mode option with values "Julian" (default) and "Gregorian" to switch between calendars processed. [month, day] list is returned.
    6. ec.AnonymousGregorian(year, mode = "optimized")
      • Processes given year according to the algorithm post in New York Times by a correspondent in 1876. mode option sets algorithm state to "optimized" (includes 1961 New Scientist's correction)(default) and the original 1867 version.The mode value is case sensitive. [month, day] list is returned.

Orthodox Easter calculus specifications:

This file uses easterlib to determine when the Easter date is, by given year. It has mainly test purpose and might be removed later.

About

Dynamic Orthodox calendar works

License:Apache License 2.0


Languages

Language:Python 68.9%Language:JavaScript 31.1%