Skip to content

Commit

Permalink
DEV: Add upcoming Eid-Ul-Adha holiday for Ghana (#582)
Browse files Browse the repository at this point in the history
  • Loading branch information
s3lase committed Jun 14, 2024
1 parent f357c7f commit 75214d6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
15 changes: 11 additions & 4 deletions vendor/holidays/definitions/gh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ months:
6:
- name: Eid-ul-Adha
regions: [gh]
mday: 28
year_ranges:
limited: [2023]
function: eid_ul_adha(year)
observed: to_monday_if_weekend(date)
7:
- name: Republic Day
regions: [gh]
Expand Down Expand Up @@ -90,6 +89,14 @@ methods:
'2024' => Date.civil(2024, 4, 11)
}
eid_ul_fitr_dates[year.to_s]
eid_ul_adha:
arguments: year
ruby: |
eid_ul_adha_dates = {
'2023' => Date.civil(2024, 6, 28)
'2024' => Date.civil(2024, 6, 16)
}
eid_ul_adha_dates[year.to_s]
tests:
- given:
Expand Down Expand Up @@ -137,7 +144,7 @@ tests:
expect:
name: "African Union Day"
- given:
date: "2023-06-28"
date: ["2023-06-28","2024-06-17" ]
regions: ["gh"]
options: ["observed"]
expect:
Expand Down
10 changes: 9 additions & 1 deletion vendor/holidays/lib/generated_definitions/gh.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def self.holidays_by_month
4 => [{:function => "eid_ul_fitr(year)", :function_arguments => [:year], :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Eid-ul-Fitr", :regions => [:gh]}],
5 => [{:mday => 1, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "May Day (Workers' Day)", :regions => [:gh]},
{:mday => 25, :type => :informal, :name => "African Union Day", :regions => [:gh]}],
6 => [{:mday => 28, :year_ranges => { :limited => [2023] },:name => "Eid-ul-Adha", :regions => [:gh]}],
6 => [{:function => "eid_ul_adha(year)", :function_arguments => [:year], :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Eid-ul-Adha", :regions => [:gh]}],
7 => [{:mday => 1, :type => :informal, :name => "Republic Day", :regions => [:gh]}],
8 => [{:mday => 4, :year_ranges => { :from => 2019 },:observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Founders' Day", :regions => [:gh]}],
9 => [{:mday => 21, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Kwame Nkrumah Memorial Day", :regions => [:gh]}],
Expand All @@ -40,6 +40,14 @@ def self.custom_methods
eid_ul_fitr_dates[year.to_s]
},

"eid_ul_adha(year)" => Proc.new { |year|
eid_ul_adha_dates = {
'2023' => Date.civil(2024, 6, 28)
'2024' => Date.civil(2024, 6, 16)
}
eid_ul_adha_dates[year.to_s]
},


}
end
Expand Down
1 change: 1 addition & 0 deletions vendor/holidays/test/defs/test_defs_gh.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def test_gh
assert_equal "African Union Day", (Holidays.on(Date.civil(2022, 5, 25), [:gh], [:informal])[0] || {})[:name]

assert_equal "Eid-ul-Adha", (Holidays.on(Date.civil(2023, 6, 28), [:gh], [:observed])[0] || {})[:name]
assert_equal "Eid-ul-Adha", (Holidays.on(Date.civil(2024, 6, 17), [:gh], [:observed])[0] || {})[:name]

assert_equal "Republic Day", (Holidays.on(Date.civil(2022, 7, 1), [:gh], [:informal])[0] || {})[:name]

Expand Down

0 comments on commit 75214d6

Please sign in to comment.