ng-computus
TypeScript icon, indicating that this package has built-in type declarations

0.2.4 • Public • Published

ngComputus

Build Status npm version

This library calculates the date of the Easter full moon in any given year. The return object provides both Gregorian and Julian reckonings. The Gregorian calendar came into use in 1582 but the algorithm can still be used in to calculate what Easter would have been in pre-1582 years. The Julian calendar is recommended for pre-1582 dates to give a historically accurate date for the celebration of Easter.

Installation

npm install -s ng-computus

Usage

The library has a single constructor to build a computus object containing both calendar reckonings.

Computus(2000) returns a object with the following structure:

{
  gregorian: { ... }
  julian: { ... }
}

Both the gregorian and julian objects have identical structures with the following properties:

dominicalLetter

Dominical letters or Sunday letters are a method used to determine the day of the week for particular dates. When using this method, each year is assigned a letter (or pair of letters for leap years) depending on which day of the week the year starts on.

easterFullMoon

The calendar reckoning of the date of the Easter full moon. To maximise portability with different Datetime libraries this is returned as an array representation in the form [day, month, year]

easterSunday

The calendar reckoning of the date of Easter Sunday. To maximise portability with different Datetime libraries this is returned as an array representation in the form [day, month, year]

goldenNumber

The number assigned to each year in sequence to indicate the year's position in a 19-year Metonic cycle.

martyrologyLetter

The Martyrology letter of the given year. It is used to indicate the order of saints and feast dates that year.

solarCycle

The solar cycle or solar magnetic activity cycle is the nearly periodic 11-year change in the Sun's activity and appearance. This is represented as a number between 1 and 11.

Development

Quick Start

# Clone the repository
git clone https://github.com/markdturner/ng-computus.git

# Go to repository folder
cd ng-computus

# Install all dependencies
yarn install

# Build the library
yarn build

File Structure

ng-computus
  ├─ src                          * Library sources home folder
  |  ├─ services                  * library services with tests
  |  ├─ index.ts                  * Library entry point that is used by builders
  |  └─ computus.module.ts        * Library module
  |
  ├─ .gitignore	                  * List of files that are ignored while publishing to git repo
  ├─ .npmignore                   * List of files that are ignored while publishing to npm
  ├─ .travis.yml                  * Travic CI configuration
  ├─ LICENSE                      * License details
  ├─ README.md                    * README instructions for the library
  ├─ gulpfile.js                  * Gulp helper scripts
  ├─ karma-test-entry.ts          * Entry script for Karma tests
  ├─ karma.conf.ts                * Karma configuration for our unit tests
  ├─ package.json                 * NPM dependencies, scripts and package configuration
  ├─ tsconfig-aot.json            * TypeScript configuration for AOT build
  ├─ tsconfig.json                * TypeScript configuration for UMD and Test builds
  ├─ tslint.json                  * TypeScript linting configuration
  ├─ webpack-test.config.ts       * Webpack configuration for building test version of the library
  ├─ webpack-umd.config.ts        * Webpack configuration for building UMD bundle
  └─ yarn.lock                    * Yarn lock file that locks dependency versions

Dependencies

Node/NPM

Install latest Node and NPM following the instructions. Make sure you have Node version ≥ 7.0 and NPM ≥ 4.

Yarn

Yarn package manager is optional but highly recommended. If you prefer to work with npm directly you may ignore this step.

Yarn installs library dependencies faster and also locks theirs versions. It has more advantages but these two are already pretty attractive.

Install Yarn by following the instructions.

Installing

clone this repository your local environment.

yarn install to install required dependencies (or npm i).

Build the library

yarn build for building the library once (both ESM and AOT versions).

yarn build:watch for building the library (both ESM and AOT versions) and watch for file changes.

You may also build UMD bundle and ESM files separately:

yarn build:esm - for building AOT/JIT compatible versions of files.

yarn build:esm:watch - the same as previous command but in watch-mode.

yarn build:umd - for building UMD bundle only.

yarn build:umd:watch - the same as previous command but in watch-mode.

Other commands

Linting

yarn lint for performing static code analysis.

Testing

yarn test for running all your *.spec.ts tests once. Generated code coverage report may be found in coverage folder.

yarn test:watch for running all you *.spec.ts and watch for file changes.

Documentation

yarn docs for generating documentation locally.

yarn gh-pages for generating documentation and uploading it to GitHub Pages. Documentation example.

Explore the bundle

yarn explorer to find out where all your code in bundle is coming from.

Bump library version

npm version patch to increase library version. More on bumping.

preversion script in this case will automatically run project testing and linting in prior in order to check that the library is ready for publishing.

Publish library to NPM

npm publish to publish your library sources on npmjs.com. Once the library is published it will be available for usage in npm packages.

prepublishOnly script in this case will automatically run project testing and linting in prior in order to check that the library is ready for publishing.

Cleaning

yarn clean:tmp command will clean up all temporary files like docs, dist, coverage etc.

yarn clean:all command will clean up all temporary files along with node_modules folder.

Readme

Keywords

Package Sidebar

Install

npm i ng-computus

Weekly Downloads

10

Version

0.2.4

License

MIT

Unpacked Size

337 kB

Total Files

62

Last publish

Collaborators

  • markdturner