Skip to content

Commit

Permalink
Merge pull request #184 from ghiculescu/master
Browse files Browse the repository at this point in the history
QLD changed Queens Bday and Labour Day again
  • Loading branch information
ppeble committed Apr 16, 2016
2 parents e9ab549 + be415e2 commit 2b56d87
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 12 deletions.
38 changes: 32 additions & 6 deletions definitions/au.yaml
Expand Up @@ -79,9 +79,12 @@ months:
week: 1
wday: 1
- name: Queen's Birthday
regions: [au_act, au_nsw, au_sa, au_qld, au_tas, au_nt, au_vic]
regions: [au_act, au_nsw, au_sa, au_tas, au_nt, au_vic]
week: 2
wday: 1
- name: Queen's Birthday
regions: [au_qld]
function: qld_queens_birthday_june(year)
- name: Queensland Day
regions: [au_qld]
mday: 6
Expand Down Expand Up @@ -168,20 +171,39 @@ methods:
qld_queens_bday_october: |
# http://www.justice.qld.gov.au/fair-and-safe-work/industrial-relations/public-holidays/dates
# celebrated twice in 2012
# in october again from 2016
def self.qld_queens_bday_october(year)
year == 2012 ? 1 : nil
if year >= 2016
Holidays.calculate_day_of_month(year, 10, 1, 1)
elsif year == 2012
1
else
nil
end
end
qld_labour_day_may: |
# http://www.justice.qld.gov.au/fair-and-safe-work/industrial-relations/public-holidays/dates
# changed from may to october after 2012
# for 2013 to 2016 it was in October, otherwise it's in May
def self.qld_labour_day_may(year)
year <= 2012 ? Holidays.calculate_day_of_month(year, 5, 1, 1) : nil
if year < 2013 || year >= 2016
Holidays.calculate_day_of_month(year, 5, 1, 1)
end
end
qld_labour_day_october: |
# http://www.justice.qld.gov.au/fair-and-safe-work/industrial-relations/public-holidays/dates
# changed from may to october after 2012
# for 2013 to 2016 it was in October, otherwise it's in May
def self.qld_labour_day_october(year)
year <= 2012 ? nil : Holidays.calculate_day_of_month(year, 10, 1, 1)
if year >= 2013 && year < 2016
Holidays.calculate_day_of_month(year, 10, 1, 1)
end
end
qld_queens_birthday_june: |
# http://www.justice.qld.gov.au/fair-and-safe-work/industrial-relations/public-holidays/dates
# in june until 2015
def self.qld_queens_birthday_june(year)
if year <= 2015
Holidays.calculate_day_of_month(year, 6, 2, 1)
end
end
g20_day_2014_only: |
# http://www.justice.qld.gov.au/fair-and-safe-work/industrial-relations/public-holidays/dates
Expand Down Expand Up @@ -245,10 +267,14 @@ tests: |
assert_equal 'Labour Day', Holidays.on(Date.civil(2013,10,7), :au_qld)[0][:name]
assert_equal 'Labour Day', Holidays.on(Date.civil(2012,5,7), :au_qld)[0][:name]
assert_equal 'Labour Day', Holidays.on(Date.civil(2015,10,5), :au_qld)[0][:name]
assert_equal 'Labour Day', Holidays.on(Date.civil(2016,5,2), :au_qld)[0][:name]
assert_equal "Queen's Birthday", Holidays.on(Date.civil(2012,6,11), :au_qld)[0][:name]
assert_equal "Queen's Birthday", Holidays.on(Date.civil(2012,10,1), :au_qld)[0][:name]
assert_equal "Queen's Birthday", Holidays.on(Date.civil(2013,6,10), :au_qld)[0][:name]
assert_equal "Queen's Birthday", Holidays.on(Date.civil(2015,6,8), :au_qld)[0][:name]
assert_equal "Queen's Birthday", Holidays.on(Date.civil(2016,10,3), :au_qld)[0][:name]
assert_equal "Queen's Birthday", Holidays.on(Date.civil(2014, 9, 29), :au_wa)[0][:name]
assert_equal "Queen's Birthday", Holidays.on(Date.civil(2015, 9, 28), :au_wa)[0][:name]
Expand Down
33 changes: 27 additions & 6 deletions lib/generated_definitions/au.rb
Expand Up @@ -36,7 +36,8 @@ def self.holidays_by_month
{:wday => 1, :week => 1, :name => "May Day", :regions => [:au_nt]},
{:function => lambda { |year| Holidays.may_pub_hol_sa(year) }, :function_id => "may_pub_hol_sa(year)", :name => "May Public Holiday", :regions => [:au_sa]}],
6 => [{:wday => 1, :week => 1, :name => "Foundation Day", :regions => [:au_wa]},
{:wday => 1, :week => 2, :name => "Queen's Birthday", :regions => [:au_act, :au_nsw, :au_sa, :au_qld, :au_tas, :au_nt, :au_vic]},
{:wday => 1, :week => 2, :name => "Queen's Birthday", :regions => [:au_act, :au_nsw, :au_sa, :au_tas, :au_nt, :au_vic]},
{:function => lambda { |year| Holidays.qld_queens_birthday_june(year) }, :function_id => "qld_queens_birthday_june(year)", :name => "Queen's Birthday", :regions => [:au_qld]},
{:mday => 6, :type => :informal, :name => "Queensland Day", :regions => [:au_qld]}],
7 => [{:wday => 5, :week => 3, :name => "Cairns Show", :regions => [:au_qld_cairns]}],
8 => [{:wday => 3, :week => -3, :name => "Ekka", :regions => [:au_qld_brisbane]}],
Expand Down Expand Up @@ -69,22 +70,42 @@ def self.afl_grand_final(year)

# http://www.justice.qld.gov.au/fair-and-safe-work/industrial-relations/public-holidays/dates
# celebrated twice in 2012
# in october again from 2016
def self.qld_queens_bday_october(year)
year == 2012 ? 1 : nil
if year >= 2016
Holidays.calculate_day_of_month(year, 10, 1, 1)
elsif year == 2012
1
else
nil
end
end


# http://www.justice.qld.gov.au/fair-and-safe-work/industrial-relations/public-holidays/dates
# changed from may to october after 2012
# for 2013 to 2016 it was in October, otherwise it's in May
def self.qld_labour_day_may(year)
year <= 2012 ? Holidays.calculate_day_of_month(year, 5, 1, 1) : nil
if year < 2013 || year >= 2016
Holidays.calculate_day_of_month(year, 5, 1, 1)
end
end


# http://www.justice.qld.gov.au/fair-and-safe-work/industrial-relations/public-holidays/dates
# changed from may to october after 2012
# for 2013 to 2016 it was in October, otherwise it's in May
def self.qld_labour_day_october(year)
year <= 2012 ? nil : Holidays.calculate_day_of_month(year, 10, 1, 1)
if year >= 2013 && year < 2016
Holidays.calculate_day_of_month(year, 10, 1, 1)
end
end


# http://www.justice.qld.gov.au/fair-and-safe-work/industrial-relations/public-holidays/dates
# in june until 2015
def self.qld_queens_birthday_june(year)
if year <= 2015
Holidays.calculate_day_of_month(year, 6, 2, 1)
end
end


Expand Down
4 changes: 4 additions & 0 deletions test/defs/test_defs_au.rb
Expand Up @@ -35,10 +35,14 @@ def test_au

assert_equal 'Labour Day', Holidays.on(Date.civil(2013,10,7), :au_qld)[0][:name]
assert_equal 'Labour Day', Holidays.on(Date.civil(2012,5,7), :au_qld)[0][:name]
assert_equal 'Labour Day', Holidays.on(Date.civil(2015,10,5), :au_qld)[0][:name]
assert_equal 'Labour Day', Holidays.on(Date.civil(2016,5,2), :au_qld)[0][:name]

assert_equal "Queen's Birthday", Holidays.on(Date.civil(2012,6,11), :au_qld)[0][:name]
assert_equal "Queen's Birthday", Holidays.on(Date.civil(2012,10,1), :au_qld)[0][:name]
assert_equal "Queen's Birthday", Holidays.on(Date.civil(2013,6,10), :au_qld)[0][:name]
assert_equal "Queen's Birthday", Holidays.on(Date.civil(2015,6,8), :au_qld)[0][:name]
assert_equal "Queen's Birthday", Holidays.on(Date.civil(2016,10,3), :au_qld)[0][:name]

assert_equal "Queen's Birthday", Holidays.on(Date.civil(2014, 9, 29), :au_wa)[0][:name]
assert_equal "Queen's Birthday", Holidays.on(Date.civil(2015, 9, 28), :au_wa)[0][:name]
Expand Down

0 comments on commit 2b56d87

Please sign in to comment.