# sub-accounting-calendar-utility

A library of calendar functions that are aware of 3 separately defined
processing calendars : 

- Trading Calendar - defines which days the NYSE is open for trading.  Governs 
trade-date (and asof) date calculations.

- Processing Calendar - defines which days the platform processes transactions;
typically follows the Trading Calendar (but is defined separately to allow 
processing even on days the NYSE is not open for trading).

- Banking Calendar - defines which days the US Fed Banking system is open.  Governs
settlement-date and banking availability date calculations.


In addition to these 3 calendars, there are also 3 parallel "early close" calendars
which contain the dates that the respective markets and business close early.  This is
used to govern time-sensitive activity cutoffs on the few days a year that 
each close early.

## Background

The library is built around the date-fns javascript library which extends the
normal Javascript date utilities.

Our library, in turn, adds convenience routines for 'date-math' which acknowledge
these 3 calendars - adding business domain functionality around these calendars.

Our standard interchange format for dates is a String of the ISO8601 standard date
format (yyyy-mm-dd).   The library provides some additional convenience functions to
make working with that format, and the more traditional fintech format of yyyymmdd
more succinct.

This library currently does not address "time".

## Functions

### Utility Functions

|function|description|
|----------------------------------------------------|---------------------------------------------------------------------------|
|toIsoDate(inDate: String or Number or Date): String)| flexible routine to parse a date and return our standard yyyy-mm-dd string|
|isValidIsoDate(inDate: String): boolean)| returns true/false if inDate is valid;  inDate is yyyy-mm-dd standard format |
|validateDateParam(inDate: String): boolean)| returns true if valid inDate; throws "Invalid Date Param" error otherwise|
