Holidays helper in Ruby on Rails

Today, while doing a calendar I found a module on Rails called Holidays.

I will use the Rails console to demonstrate:

bundle exec rails c

Loading development environment (Rails 5.0.1)
[1] pry(main)> Holidays.on(Date.tomorrow, :pt)
=> [{:date=>Wed, 01 Nov 2017, :name=>"Dia de Todos-os-Santos", :regions=>[:pt]}]

[2] pry(main)> Holidays.on(Date.today, :pt)
=> []
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s