Module: Holidays::AU

Defined in:
lib/generated_definitions/au.rb

Overview

This file is generated by the Ruby Holidays gem.

Definitions loaded: definitions/au.yaml

All the definitions are available at github.com/holidays/holidays

Class Method Summary collapse

Class Method Details

.custom_methodsObject



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/generated_definitions/au.rb', line 64

def self.custom_methods
  {
      "afl_grand_final(year)" => Proc.new { |year|
case year
when 2015
  Date.civil(2015, 10, 2)
when 2016
  Date.civil(2016, 9, 30)
when 2017
  Date.civil(2017, 9, 29)
when 2018
  Date.civil(2018, 9, 28)
when 2019
  Date.civil(2019,9, 27)
when 2020
  Date.civil(2020, 10, 23)
end
},

"qld_queens_bday_october(year)" => Proc.new { |year|
if year >= 2016
  Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 10, 1, 1)
elsif year == 2012
  1
else
  nil
end
},

"qld_kings_bday_october(year)" => Proc.new { |year|
if year >= 2023
  Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 10, 1, 1)
else
  nil
end
},

"qld_queens_birthday_june(year)" => Proc.new { |year|
if year <= 2015
  Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 6, 2, 1)
end
},

"qld_labour_day_may(year)" => Proc.new { |year|
if year < 2013 || year >= 2016
  Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 5, 1, 1)
end
},

"qld_labour_day_october(year)" => Proc.new { |year|
if year >= 2013 && year < 2016
  Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 10, 1, 1)
end
},

"g20_day_2014_only(year)" => Proc.new { |year|
year == 2014 ? 14 : nil
},

"hobart_show_day(year)" => Proc.new { |year|
fourth_sat_in_oct = Date.civil(year, 10, Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 10, 4, :saturday))
fourth_sat_in_oct - 2 # the thursday before
},

"march_pub_hol_sa(year)" => Proc.new { |year|
if year < 2006
  nil
else
  Date.civil(year, 3, Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 3, :second, :monday))
end
},

"may_pub_hol_sa(year)" => Proc.new { |year|
if year >= 2006
  nil
else
  Date.civil(year, 5, Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 5, :third, :monday))
end
},

"qld_brisbane_ekka_holiday(year)" => Proc.new { |year|
first_friday = Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 8, :first, :friday)

if first_friday < 5
  second_friday = Date.civil(year, 8, Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 8, :second, :friday))
  second_friday + 5 # The next Wednesday
else
  Date.civil(year, 8, first_friday) + 5
end
},

"to_nearest_monday_after(date)" => Proc.new { |date|
case date.wday
when 6
  date += 2
when 5
  date += 3
when 4
  date += 4
when 3
  date += 5
when 2
  date += 6
when 0
  date += 1
end
date
},


  }
end

.defined_regionsObject

:nodoc:



9
10
11
# File 'lib/generated_definitions/au.rb', line 9

def self.defined_regions
  [:au, :au_nsw, :au_vic, :au_qld, :au_nt, :au_act, :au_sa, :au_wa, :au_tas, :au_tas_south, :au_qld_cairns, :au_qld_brisbane, :au_tas_north, :au_vic_melbourne]
end

.holidays_by_monthObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/generated_definitions/au.rb', line 13

def self.holidays_by_month
  {
            0 => [{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -2, :name => "Good Friday", :regions => [:au]},
        {:function => "easter(year)", :function_arguments => [:year], :function_modifier => -1, :name => "Easter Saturday", :regions => [:au_nsw, :au_vic, :au_qld, :au_nt, :au_act, :au_sa]},
        {:function => "easter(year)", :function_arguments => [:year], :name => "Easter Sunday", :regions => [:au_nsw, :au_vic]},
        {:function => "easter(year)", :function_arguments => [:year], :year_ranges => { :from => 2017 },:name => "Easter Sunday", :regions => [:au_qld, :au_act]},
        {:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :name => "Easter Monday", :regions => [:au]}],
  1 => [{:mday => 1, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "New Year's Day", :regions => [:au, :au_nsw, :au_vic, :au_act, :au_sa, :au_wa, :au_nt, :au_qld]},
        {:mday => 1, :function => "to_monday_if_weekend(date)", :function_arguments => [:date], :name => "New Year's Day", :regions => [:au_tas]},
        {:mday => 26, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :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]},
        {:function => "march_pub_hol_sa(year)", :function_arguments => [:year], :name => "March Public Holiday", :regions => [:au_sa]},
        {:wday => 1, :week => 2, :name => "Canberra Day", :regions => [:au_act]}],
  4 => [{:mday => 25, :name => "ANZAC Day", :regions => [:au, :au_vic]},
        {:mday => 25, :observed => "to_monday_if_sunday(date)", :observed_arguments => [:date], :name => "ANZAC Day", :regions => [:au_nsw, :au_qld, :au_nt, :au_act, :au_sa, :au_tas]},
        {:mday => 25, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "ANZAC Day", :regions => [:au_wa]}],
  5 => [{:function => "qld_labour_day_may(year)", :function_arguments => [:year], :name => "Labour Day", :regions => [:au_qld]},
        {:wday => 1, :week => 1, :name => "May Day", :regions => [:au_nt]},
        {:function => "may_pub_hol_sa(year)", :function_arguments => [:year], :name => "May Public Holiday", :regions => [:au_sa]},
        {:mday => 27, :function => "to_nearest_monday_after(date)", :function_arguments => [:date], :year_ranges => { :from => 2018 },:name => "Reconciliation Day", :regions => [:au_act]}],
  6 => [{:wday => 1, :week => 1, :name => "Western Australia Day", :regions => [:au_wa]},
        {:wday => 1, :week => 2, :year_ranges => { :until => 2022 },:name => "Queen's Birthday", :regions => [:au_act, :au_nsw, :au_sa, :au_tas, :au_nt, :au_vic]},
        {:wday => 1, :week => 2, :year_ranges => { :from => 2023 },:name => "King's Birthday", :regions => [:au_act, :au_nsw, :au_sa, :au_tas, :au_nt, :au_vic]},
        {:function => "qld_queens_birthday_june(year)", :function_arguments => [: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 => [{:function => "qld_brisbane_ekka_holiday(year)", :function_arguments => [:year], :name => "Ekka", :regions => [:au_qld_brisbane]}],
  9 => [{:mday => 22, :year_ranges => { :limited => [2022] },:name => "National Day of Mourning for Her Majesty Queen Elizabeth II", :regions => [:au]},
        {:wday => 1, :week => -1, :year_ranges => { :until => 2021 },:name => "Queen's Birthday", :regions => [:au_wa]},
        {:wday => 1, :week => -1, :year_ranges => { :from => 2022 },:name => "King's Birthday", :regions => [:au_wa]},
        {:wday => 1, :week => -1, :year_ranges => { :until => 2017 },:name => "Family & Community Day", :regions => [:au_act]}],
  10 => [{:function => "afl_grand_final(year)", :function_arguments => [:year], :name => "Friday before the AFL Grand Final", :regions => [:au_vic]},
        {:wday => 1, :week => 1, :name => "Labour Day", :regions => [:au_act, :au_nsw, :au_sa]},
        {:function => "qld_labour_day_october(year)", :function_arguments => [:year], :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Labour Day", :regions => [:au_qld]},
        {:function => "qld_queens_bday_october(year)", :function_arguments => [:year], :year_ranges => { :until => 2022 },:observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Queen's Birthday", :regions => [:au_qld]},
        {:function => "qld_kings_bday_october(year)", :function_arguments => [:year], :year_ranges => { :from => 2023 },:observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "King's Birthday", :regions => [:au_qld]},
        {:function => "hobart_show_day(year)", :function_arguments => [:year], :name => "Royal Hobart Show", :regions => [:au_tas_south]}],
  11 => [{:function => "g20_day_2014_only(year)", :function_arguments => [:year], :name => "G20 Day", :regions => [:au_qld_brisbane]},
        {:wday => 1, :week => 1, :name => "Recreation Day", :regions => [:au_tas_north]},
        {:wday => 2, :week => 1, :name => "Melbourne Cup Day", :regions => [:au_vic_melbourne]}],
  12 => [{:mday => 25, :observed => "to_tuesday_if_sunday_or_monday_if_saturday(date)", :observed_arguments => [:date], :name => "Christmas Day", :regions => [:au_qld, :au_nsw, :au_act, :au_tas, :au_wa, :au_vic, :au_nt]},
        {:mday => 26, :observed => "to_tuesday_if_sunday_or_monday_if_saturday(date)", :observed_arguments => [:date], :name => "Boxing Day", :regions => [:au_nsw, :au_vic, :au_qld, :au_act, :au_wa]},
        {:function => "to_weekday_if_boxing_weekend_from_year(year)", :function_arguments => [:year], :name => "Boxing Day", :regions => [:au_tas, :au_nt]},
        {:function => "to_weekday_if_boxing_weekend_from_year_or_to_tuesday_if_monday(year)", :function_arguments => [:year], :name => "Proclamation Day", :regions => [:au_sa]},
        {:mday => 25, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Christmas Day", :regions => [:au_sa]}]
  }
end