Skip to content

Commit

Permalink
NEW: hobart regatta day
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiculescu committed Feb 13, 2015
1 parent 99f0d6f commit 6e256dc
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
12 changes: 11 additions & 1 deletion data/au.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ months:
regions: [au]
mday: 26
observed: to_monday_if_weekend
2:
- name: Royal Hobart Regatta
regions: [au_tas_south]
week: 2
wday: 1
3:
- name: Labour Day
regions: [au_wa]
Expand Down Expand Up @@ -224,4 +229,9 @@ tests: |
assert_equal [], Date.civil(2015,11,14).holidays(:au_qld_brisbane)
assert_equal 'Melbourne Cup Day', Date.civil(2014,11,4).holidays(:au_vic)[0][:name]
assert_equal 'Melbourne Cup Day', Date.civil(2015,11,3).holidays(:au_vic)[0][:name]
assert_equal 'Melbourne Cup Day', Date.civil(2015,11,3).holidays(:au_vic)[0][:name]
assert_equal 'Royal Hobart Regatta', Date.civil(2012, 2, 13).holidays(:au_tas_south)[0][:name]
assert_equal 'Royal Hobart Regatta', Date.civil(2014, 2, 10).holidays(:au_tas_south)[0][:name]
assert_equal 'Royal Hobart Regatta', Date.civil(2015, 2, 9).holidays(:au_tas_south)[0][:name]
assert_equal 'Royal Hobart Regatta', Date.civil(2016, 2, 8).holidays(:au_tas_south)[0][:name]
3 changes: 2 additions & 1 deletion lib/holidays/au.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module Holidays
# All the definitions are available at https://github.com/alexdunae/holidays
module AU # :nodoc:
def self.defined_regions
[:au, :au_nsw, :au_vic, :au_qld, :au_nt, :au_act, :au_sa, :au_qld_brisbane, :au_qld_cairns, :au_tas, :au_wa, :au_tas_south, :au_tas_north]
[:au, :au_nsw, :au_vic, :au_qld, :au_nt, :au_act, :au_sa, :au_qld_brisbane, :au_qld_cairns, :au_tas, :au_tas_south, :au_wa, :au_tas_north]
end

def self.holidays_by_month
Expand All @@ -25,6 +25,7 @@ def self.holidays_by_month
{:function => lambda { |year| Holidays.easter(year)+2 }, :function_id => "easter(year)+2", :name => "Easter Monday", :regions => [:au_tas]}],
1 => [{:mday => 1, :observed => lambda { |date| Holidays.to_monday_if_weekend(date) }, :observed_id => "to_monday_if_weekend", :name => "New Year's Day", :regions => [:au]},
{:mday => 26, :observed => lambda { |date| Holidays.to_monday_if_weekend(date) }, :observed_id => "to_monday_if_weekend", :name => "Australia Day", :regions => [:au]}],
2 => [{:wday => 1, :week => 2, :name => "Royal Hobart Regatta", :regions => [:au_tas_south]}],
3 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:au_wa]},
{:wday => 1, :week => 2, :name => "Eight Hours Day", :regions => [:au_tas]},
{:wday => 1, :week => 2, :name => "Labour Day", :regions => [:au_vic]}],
Expand Down
5 changes: 5 additions & 0 deletions test/defs/test_defs_au.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,10 @@ def test_au

assert_equal 'Melbourne Cup Day', Date.civil(2014,11,4).holidays(:au_vic)[0][:name]
assert_equal 'Melbourne Cup Day', Date.civil(2015,11,3).holidays(:au_vic)[0][:name]

assert_equal 'Royal Hobart Regatta', Date.civil(2012, 2, 13).holidays(:au_tas_south)[0][:name]
assert_equal 'Royal Hobart Regatta', Date.civil(2014, 2, 10).holidays(:au_tas_south)[0][:name]
assert_equal 'Royal Hobart Regatta', Date.civil(2015, 2, 9).holidays(:au_tas_south)[0][:name]
assert_equal 'Royal Hobart Regatta', Date.civil(2016, 2, 8).holidays(:au_tas_south)[0][:name]
end
end

0 comments on commit 6e256dc

Please sign in to comment.