The Ruby holidays gem has been released and I’m looking for
contributors to help create regional holiday definition files. This
gem provides a set of functions for looking up public holidays around
the world.
A quick example:
require ‘holidays’
require ‘holidays/ca’
Lookup Canada Day
date = Date.civil(2007,7,1)
Holidays.by_day(date, :ca)
=> [{:name => ‘Canada Day’,…}]
Canada Day is July 1 except when July 1 is a Sunday, then it moves
to
July 2
date = Date.civil(2007,7,2)
Holidays.by_day(date, :ca, :observed)
=> [{:name => ‘Canada Day’,…}]
Check if this is a holiday in British Columbia, Canada
date.holiday?(:ca_bc)
=> true
There are a lot of countries in the world and contributors are invited
to create or improve a holiday definition file for any region. Sample
definition files can be found at
http://code.dunae.ca/svn/holidays/trunk/data/
- get in touch if you would like to help out: alex [at] dunae dot ca.
The project page is here: http://code.dunae.ca/holidays/
The docs are here: http://code.dunae.ca/holidays/doc/