Skip to content

Commit

Permalink
Merge pull request #27 from TandaHQ/master
Browse files Browse the repository at this point in the history
Updates to Australian & Vietnamese holidays
  • Loading branch information
ppeble authored Mar 12, 2017
2 parents 76be591 + bf6b149 commit dab4011
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 11 deletions.
25 changes: 22 additions & 3 deletions au.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,24 @@ months:
- name: Easter Sunday
regions: [au_nsw, au_vic]
function: easter(year)
- name: Easter Sunday
regions: [au_qld]
function: easter(year)
year_ranges:
- after: 2017
- name: Easter Monday
regions: [au]
function: easter(year)
function_modifier: 1
1:
- name: New Year's Day
regions: [au]
regions: [au_nsw, au_vic, au_act, au_sa, au_wa, au_nt, au_qld]
mday: 1
observed: to_monday_if_weekend(date)
- name: New Year's Day
regions: [au_tas]
mday: 1
function: to_monday_if_weekend(date)
- name: Australia Day
regions: [au]
mday: 26
Expand All @@ -53,6 +62,10 @@ months:
- name: March Public Holiday
regions: [au_sa]
function: march_pub_hol_sa(year)
- name: Canberra Day
regions: [au_act]
week: 2
wday: 1
4:
- name: ANZAC Day
regions: [au]
Expand Down Expand Up @@ -378,8 +391,14 @@ tests: |
assert_equal "Christmas Day", Date.civil(2016, 12, 27).holidays(:au_nt, :observed)[0][:name]
# NEW YEAR'S DAY - observed on both 1st and 2nd of Jan for 2017
regions = [:au_qld, :au_nsw, :au_act, :au_vic, :au_tas, :au_sa, :au_wa, :au_nt]
regions = [:au_qld, :au_nsw, :au_act, :au_vic, :au_sa, :au_wa, :au_nt]
regions.each do |r|
assert_equal "New Year's Day", Date.civil(2017, 1, 1).holidays(r)[0][:name]
assert_equal "New Year's Day", Date.civil(2017, 1, 2).holidays(r, :observed)[0][:name]
end
end
# Tasmania is different
assert_equal [], Date.civil(2017,1,1).holidays(:au_tas)
assert_equal "New Year's Day", Date.civil(2017, 1, 2).holidays(:au_tas)[0][:name]
#QLD now celebrates Easter Sunday
assert_equal "Easter Sunday", Date.civil(2017, 4, 16).holidays(:au_qld)[0][:name]
16 changes: 8 additions & 8 deletions vi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@
---
months:
1:
- name: New Year
- name: Tết dương lịch
regions: [vi]
mday: 1
4:
- name: Liberation Day
- name: "Ngày Giải phóng miền Nam, thống nhất đất nước"
regions: [vi]
mday: 30
5:
- name: International Workers' Day
- name: Ngày Quốc tế Lao động
regions: [vi]
mday: 1
9:
- name: National Day
- name: Quốc khánh
regions: [vi]
mday: 2
tests: |
{Date.civil(2014,1,1) => 'New Year',
Date.civil(2014,4,30) => 'Liberation Day',
Date.civil(2014,5,1) => "International Workers' Day",
Date.civil(2014,9,2) => 'National Day'}.each do |date, name|
{Date.civil(2014,1,1) => 'Tết dương lịch',
Date.civil(2014,4,30) => 'Ngày Giải phóng miền Nam, thống nhất đất nước',
Date.civil(2014,5,1) => "Ngày Quốc tế Lao động",
Date.civil(2014,9,2) => 'Quốc khánh'}.each do |date, name|
assert_equal name, (Holidays.on(date, :vi)[0] || {})[:name]
end

0 comments on commit dab4011

Please sign in to comment.