Skip to content

Latest commit

 

History

History
52 lines (39 loc) · 1.47 KB

README.md

File metadata and controls

52 lines (39 loc) · 1.47 KB

Businex

Hex pm Build Status

Date calculations based on business calendars. Note, only support for BACS calendar currently. This lib takes influence from the Ruby gem business.

Installation

If available in Hex, the package can be installed by adding businex to your list of dependencies in mix.exs:

def deps do
  [
    {:businex, "~> 0.2.0"}
  ]
end

Ensure businex is started before your application:

def application do
  [applications: [:businex]]
end

Usage

Here are some examples of how to use businex.

iex> Businex.Calendar.set_calendar(:bacs) # :bacs is the default.
:ok
iex> date = Timex.parse!("2018-02-01", "{YYYY}-{0M}-{D}")
iex> Businex.Calendar.next_business_day(date)
~N[2018-02-02 00:00:00]
  iex> Businex.Calendar.business_day?(date)
true
iex> Businex.Calendar.add_business_days(date, 2)
~N[2018-02-05 00:00:00]

Tests

mix test

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/businex.