Skip to content
This repository has been archived by the owner on May 4, 2020. It is now read-only.

Commit

Permalink
Only show tinsel on Christmas Day, Boxing Day & New Year's Day bank h…
Browse files Browse the repository at this point in the history
…olidays

- Previously, we showed tinsel on all bank holidays that fell in
  December and January, assuming that they were only Christmas Day,
  Boxing Day and New Year's Day.
- This year (and presumably other years in the past/future), St Andrew's
  Day in Scotland was a substitute day on 2nd December. We showed
  tinsel, when we should have just showed normal bunting.
- This also accounts for all possible substitute Christmas/New Year bank
  holidays.
  • Loading branch information
issyl0 committed Dec 3, 2019
1 parent ec59d3b commit d3553d4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/models/calendar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def show_bunting?
end

def bunting_styles
if [1, 12].include? Time.zone.today.month
if christmas? || new_year?
"tinsel"
else
""
Expand All @@ -67,4 +67,12 @@ def content_id
def body
@data["body"]
end

def christmas?
Time.zone.today.month == 12 && (25..28).include?(Time.zone.today.day)
end

def new_year?
Time.zone.today.month == 1 && (1..4).include?(Time.zone.today.day)
end
end

0 comments on commit d3553d4

Please sign in to comment.