Project

holiday_co

0.0
No release in over a year
A simple gem to handle holidays in Colombia
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

HolidayCo

The HolidayCo Gem is a simple Ruby library that simplifies the handling of holidays in Colombia. It provides a straightforward way to:

  • Determine whether a specific date is a holiday in Colombia.
  • Retrieve a list of all holidays in a given year.
  • Access holiday names and dates.

Installation

Add this line to your application's Gemfile:

gem 'holiday_co'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install holiday_co

Usage

Check if a specific date is a holiday.

date = Date.new(2023, 12, 25)
if HolidayCo.is_holiday?(date)
  puts "#{date} is a holiday in Colombia!"
end

The argument can be a String, too.

if HolidayCo.is_holiday?("2024-01-01")
  puts "¡Feliz Año Nuevo!"
end

If no date is provided, the gem will automatically default to today's date.

if HolidayCo.is_holiday?
  puts "Today is a holiday in Colombia!"
end

You can also use the holiday? alias.

if HolidayCo.holiday?(Date.tomorrow)
  puts "What time is the party tomorrow?"
end

# `Date.tomorrow` is a Rails method

List holidays for a specific year.

year = 2023
holidays = HolidayCo.holidays(year)
puts "Holidays in #{year}:"
holidays.each do |holiday|
  puts "#{holiday[:date]}: #{holiday[:name]}"
end

If no year is provided, the gem will automatically default to the current year.

HolidayCo.holidays.first[:date]
=> "2023-01-01" # Ran this on Sep 7th, 2023.

You can also retrieve holiday names and dates separately.

HolidayCo.holidays_names(2023)
=> ["Año Nuevo", "Epifanía", "Día de San José", "Jueves Santo", "Viernes San...
HolidayCo.holidays_dates(2023)
=> ["2023-01-01", "2023-01-09", "2023-03-20", "2023-04-06", "2023-04-07", "2...

Contributing

Bug reports and pull requests are welcome on GitHub. This project is intended to be a safe, welcoming space for collaboration.

License

The gem is available as open source under the terms of the MIT License.