Skip to content

A platform for community discussion. Free, open, simple.

FIX: Define the typical AFL Grand Final date. (#34768)

Gary Pendergast8990c973ecb9
diff --git a/plugins/discourse-calendar/vendor/holidays/definitions/au.yaml b/plugins/discourse-calendar/vendor/holidays/definitions/au.yaml
index 310f28e8672..061f2c1c400 100644
--- a/plugins/discourse-calendar/vendor/holidays/definitions/au.yaml
+++ b/plugins/discourse-calendar/vendor/holidays/definitions/au.yaml
@@ -180,21 +180,22 @@ months:
methods:
afl_grand_final:
+ # The AFL Grand Final is typically held on the last Saturday in September.
+ # Starting 2015, the day before the Grand Final is observed as a public holiday in Victoria.
+ # Some years are exceptions, these are defined manually.
arguments: year
ruby: |
case year
+ when year < 2015
+ nil
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)
+ else
+ Date.civil(year, 9, Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 9, :last, :saturday) - 1)
end
qld_queens_bday_october:
# http://www.justice.qld.gov.au/fair-and-safe-work/industrial-relations/public-holidays/dates
diff --git a/plugins/discourse-calendar/vendor/holidays/lib/generated_definitions/au.rb b/plugins/discourse-calendar/vendor/holidays/lib/generated_definitions/au.rb
index a7967da7f5d..e758643abc5 100644
--- a/plugins/discourse-calendar/vendor/holidays/lib/generated_definitions/au.rb
+++ b/plugins/discourse-calendar/vendor/holidays/lib/generated_definitions/au.rb
@@ -61,18 +61,16 @@ module Holidays
{
"afl_grand_final(year)" => Proc.new { |year|
case year
+when year < 2015
+ nil
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)
+else
+ Date.civil(year, 9, Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 9, :last, :saturday) - 1)
end
},