JSPM

romcal

1.0.4
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2365
  • Score
    100M100P100Q87820F
  • License MIT

Generates the General Roman Calendar used in the Catholic Rite (Western Church)

Package Exports

  • romcal
  • romcal/package.json

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (romcal) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Build Status MIT License NPM version NPM downloads

Romcal

Generates the General Roman Calendar used in the Catholic Rite.

Description

Romcal is a module that generates the General Roman Calendar used in the Roman Catholic Rite. This module conforms to the revised liturgical calendar for the Western Church as approved by Paul VI in Mysterii Paschalis dated 14 February 1969. This module will output dates based on the standard calendar year (Jan, 1st - Dec, 31st) even though the liturgical year begins with the First Sunday of Advent.

Features

  • Able to query liturgical dates for any year in the gregorian calendar (1582 - now). Note that dates for years before 1969 will still be returned in a format conforming to Mysterii Paschalis even though those years came before the calendar reforms in 1969.
  • 30 filter queries to allow more strealined date results to be obtained for the year
  • Localization of liturgical date names to cater for different countries/languages
  • National liturgical calendars of 41 countries

NOTE:This module relies heavily on Moment and Lo-Dash (which are dependencies of this module) for most of its calculations and operations. Twix is also extensively used for creating and manipulating date ranges.

Revisions

  • 1.0.4 Bug fixes for National Calendars
  • 1.0.3 National calendars [beta] and a new localization mechanism
  • 1.0.2 Fix incorrect moment dependency version and added holyWeek query
  • 1.0.1 Added more TDD tests
  • 1.0.0 Initial release

Usage

Add romcal to your project via npm:

$ npm install romcal

Then require romcal in your node project:

var romcal = require('romcal');

Get an array of liturgical dates for a year by calling the calendarFor() method. The method accepts 2 optional parameters and 1 mandatory parameter:

  1. year optional The Gregorian year as a string. Defaults to current year if null
  2. locale optional The locale (e.g. en-US, en-GB, fr-FR). Defaults to en-US if null
  3. cb mandatory The callback function where the computed liturgical dates will be returned

Note: At the moment, romcal only contains localized values for the en-US locale. Passing in any other locale will return en-US texts until those locales are localized.

romcal.calendarFor( function( dates ) {
    console.log( dates );
});

romcal.calendarFor('2014', function( dates ) {
    console.log( dates );
});

romcal.calendarFor('2014', 'en-US', function( dates ) {
    console.log( dates );
});

Each item in the array returned is an object literal that contains:

  1. A moment object definition for the liturgical date (all dates returned in UTC)
  2. The type of liturgical date (e.g. Solemnity, Memorial, Sunday, Weekday .. )
  3. The name of the liturgical date (localizable)
  4. Additional data pertaining to the liturgical date (e.g. liturgical season )

Query API

romcal also provides additional queries that can be used to streamline the original date output via the queryFor() method.

romcal.queryFor('mondays', dates, function( err, query ) {
    console.log( query );
});

The method accepts 2 parameters:

  1. query mandatory The query type to perform (see below)
  2. dates mandatory An array of dates returned by calendarFor()
  3. callback mandatory The callback function with 2 parameters:
    • err A JSON object describing the error (if any). null if there are no errors
    • query The filtered liturgical dates will be returned

Queries for date ranges

  • ordinaryTime
    • Returns an array of dates in the season of Ordinary Time (Day after Baptism of the Lord till day before Ash Wednesday & dat after Pentecost to Christ the King)
  • lent
    • Returns an array of dates corresponding to the season of Lent (Ash Wednesday up to the day beforee Palm Sunday)
  • holyWeek
    • Returns an array of dates from Palm Sunday to Easter Vigil
  • easter
    • Returns an array of dates corresponding to the season of Easter (Easter Sunday up to Pentecost)
  • advent
    • Returns an array of dates in the season of Advent ( 1st Sunday of Advent to Christmas Eve)
  • christmastide
    • Returns an array of dates from Christmas day to Epiphany

Queries for specific liturgical date types

  • feastsOfTheLord
    • An array of dates for Baptism of the Lord, Presentation of the Lord, Transfiguration, Triumph of the Cross and Holy Family
  • memorials
    • An array of memorials throughout the liturgical year conforming to the General Roman Calendar. It does not include memorials from National, Diocesan or Parish level calendars.
  • optionalMemorials
    • An array of optional memorials throughout the liturgical year conforming to the General Roman Calendar. It does not include memorials from National, Diocesan or Parish level calendars.
  • commemoration
    • An array of downgraded memorials/optional memorials that occur only during the season of Lent
  • solemnities
    • Returns an array of the highest ranking feast days throughout the liturgical year

Other queries to return days or months

  • sundays
  • mondays
  • tuesdays
  • wednesdays
  • thursdays
  • fridays
  • saturdays
  • daysGrouped
    • Returns all dates in the year grouped by day
  • january
  • february
  • march
  • april
  • may
  • june
  • july
  • august
  • september
  • october
  • november
  • december

National Calendars [Beta]

Romcal is able to display the national calendars (specific liturgical dates of a country) for 41 countries.

To query a national calendar, use the queryNationalCalendar() method. queryNationalCalendar() is much more rigid than the standard calendarFor() method. All parameters are mandatory and romcal will return null or throw an error if any of these parameters are not satisfied. The parameters in order are:

  1. year mandatory The year of liturgical dates to be obtained
  2. locale mandatory The locale (e.g. en-US, en-GB, fr-FR)
  3. country mandatory The country of which the national calendar is to be obtained. Possible values for this parameter are:
    • argentina
    • australia
    • belgium
    • bolivia
    • bosniaHerzegovina
    • brazil
    • canada
    • chile
    • croatia
    • czechRepublic
    • england
    • france
    • finland
    • germany
    • greece
    • hungary
    • india
    • ireland
    • japan
    • lebanon
    • lithuania
    • malta
    • mexico
    • newZealand
    • norway
    • peru
    • philippines
    • poland
    • portugal
    • puertoRico
    • romania
    • russia
    • scotland
    • slovakia
    • spain
    • sriLanka
    • ukraine
    • unitedStates
    • vietnam
    • wales
  4. callback mandatory The callback function with 2 parameters:
    • err An error object if any errors occured. null if no errors
    • result An array of dates for the National Liturgical year of the country

Adding National Calendars

  1. National Calendars can be added to romcal by editing the calendars() function in lib/utils.js. This function returns an object literal containing attributes of the General calendar as well as National Calendars. New countries can be added on by referring to the format of this object literal.
  2. The next file to edit is lib/nationalCalendar.js. The country and the specific celebrations as defined in its National Calendar (as determined by the council of Bishops and approved by the Holy See) is added to the dates() function. Ensure that the newly added country conforms to the defined object literal structure.
  3. Finally, create localizable entries for celebrations of the country's national calendar via data/localization.json

Localization

  • Display names for liturgical dates in romcal are localizable.
  • romcal can potentially support an unlimited number of language-locales
  • data/localization.json is a data file in JSON format that holds all localized liturgical date names.
  • As of this release, romcal only contains valid localizable values for en-US. Eagerly looking forward to contributions to help localize the other languages!
  • Contributing localizations for romcal is easy:
    • Open up data/localization.json in your favourite JSON Editor (e.g JSON Editor Online )
    • Enter localized text for an item (e.g. ourLadyMediatrix) based on its locale code (e.g en-GB)
    • Save and submit the updated data/localization.json file

Roadmap

  • Better testing scripts (I am still quite new to Mocha, Should etc)
  • Psalter weeks
  • More localization values for locales
  • More queries

If you have any suggestions for improvement, feel free to contribute to this exciting project!

Acknowledgements

The development of romcal is inspired by the work of Kenneth G, Bath who wrote a General Roman Calendar in the C language. This module is not a port of the C program and does not use any of the C code in that program. This module is written from scratch with the aim of provide similar output as the original C program while providing additional queries for convenient filtering/streamlining of date results.

License

romcal is freely distributable under the terms of the MIT license.