DateOperations

Different date operations, primarily around business days, based on the Holidays Gem.

Installation

Add this line to your application's Gemfile:

gem 'dateoperations'

And then execute:

bundle install

Or install it yourself as:

gem install dateoperations

Examples

require 'dateoperations'

DateOperations.country #=> :de

DateOperations.holiday?(Date.new(2016, 10, 3)) #=> true

DateOperations.country = :us #=> :us
DateOperations.holiday?(Date.new(2016, 10, 3)) #=> false

DateOperations.country = :de #=> :de
DateOperations.number_of_business_days_between(Date.new(2016, 10, 1), Date.new(2016, 10, -1)) #=> 20

DateOperations.country = :au #=> :au
DateOperations.number_of_business_days_between(Date.new(2016, 10, 1), Date.new(2016, 10, -1)) #=> 21

DateOperations.weekend?(Date.new(2016, 6, 18)) #=> true

Documentation