# BusinessDays

A neat library to do business days intervals given a set of calendars.

## Usage

Initalize the server with a map of holiday calendars:

      "USD" => [{2018, 4, 7}, "2018-12-25", ~D[2018-01-01]],
      "other" => ~W[2018-04-07 2018-10-01]

The dates in the calendars can be plain strings, Date objects or erlang
date-like tuples. Any non-conformant element of a calendar will be logged
and skipped.

Now you can calculate forwards and backwards intervals:

    iex> BusinessDays.since(~D[2018-07-03], 1, ~W[USD])

    iex> BusinessDays.ago(~D[2018-07-05], 1, ~W[USD])

Negative skips are supported, behaving as the "opposite" method was called:

    iex> BusinessDays.ago(~D[2018-07-03], -1, ~W[USD])

    iex> BusinessDays.since(~D[2018-07-05], -1, ~W[USD])

Week-ends are skipped too:

    iex> BusinessDays.since(~D[2018-07-28], 0)

    iex> BusinessDays.ago(~D[2018-07-28], 0)

## Installation

If [available in Hex](, the package can be installed
by adding `business_days` to your list of dependencies in `mix.exs`:

def deps do
    {:business_days, "~> 0.1.0"}

Documentation can be generated with [ExDoc](
and published on [HexDocs]( Once published, the docs can
be found at [](