holidays / holidays

A collection of Ruby methods to deal with statutory and other holidays. You deserve a holiday!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Inexisting countries support & GB date error

MeddyRichardCrisalid opened this issue · comments

Hello!
I would like to know whether more countries will be supported or not (like China, which is currently not).

Also, I would like to point out an error. I was displaying UK holidays and checking them out manually, when I found something interesting. The gem returns "St. Patrick's Day" (gb_nir) as being on 2018-03-17 (Saturday), when the government site says it was on 2018-03-19 (Monday)! I believe that in the UK, if a holiday falls on a weekend, then it is applied on the following Monday (making the gem date correct, actually). Will things like this be taken care of in the future, or should I expect some irregularities and deal with them manually?

To illustrate my saying, here are some screenshots:
https://www.gov.uk/bank-holidays#northern-ireland:
image

In my terminal:
image

Thank you!

@MeddyRichardCrisalid Sorry for the delay! Let me respond to each part.

Available regions

We rely on contributors from around the world for definition updates. Unfortunately I don't have any concrete plans to add additional regions simply because I don't know the important holidays (or their behavior) in each country. Specifically in China I would probably get all of the calendar dates incorrect. 😄

You can check out our CONTRIBUTING guide for information on how to add to the definitions if you are so inclined!

Weekend to Monday

What you are saying totally makes sense to me! I think this probably falls into the same explanation as above. Since neither myself nor @ttwo32 are from Northern Ireland we don't know about the government rules or how the locals view each holiday.

The St. Patrick's Day definition is currently marked as informal. On the page you linked it says 'Your employer doesn’t have to give you paid leave on bank or public holidays.' I am guessing that the person that originally wrote the definitions felt that this didn't qualify to be moved to Monday since it was informal. 🤷‍♂️

To me it makes sense to move it to Monday if it falls on a weekend. I've gone ahead and done that. I'll get it pulled into this gem and get it released in the near future. It'll look like this:

irb(main):001:0> Holidays.between(Date.new(2018, 3, 1), Date.new(2018, 3, 30), :gb_nir, :informal)
=> [{:date=>#<Date: 2018-03-17 ((2458195j,0s,0n),+0s,2299161j)>, :name=>"St. Patrick's Day", :regions=>[:gb_nir]}, {:date=>#<Date: 2018-03-30 ((2458208j,0s,0n),+0s,2299161j)>, :name=>"Good Friday", :regions=>[:gb]}]
irb(main):002:0> Holidays.between(Date.new(2018, 3, 1), Date.new(2018, 3, 30), :gb_nir, :informal, :observed)
=> [{:date=>#<Date: 2018-03-19 ((2458197j,0s,0n),+0s,2299161j)>, :name=>"St. Patrick's Day", :regions=>[:gb_nir]}, {:date=>#<Date: 2018-03-30 ((2458208j,0s,0n),+0s,2299161j)>, :name=>"Good Friday", :regions=>[:gb]}]

By also passing in :observed you can see that St. Patrick's Day is showing 3/19 as you expected.

I am going to close this, hoping that I answered your questions. If you spot any other things that you feel are incorrect or otherwise invalid in the definitions please open an issue!