Skip to content
Elixir business day calculations
Elixir
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config
lib
test
.formatter.exs
.gitignore
.travis.yml
README.md
mix.exs
mix.lock

README.md

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.

You can’t perform that action at this time.