zeus.ugent.be/lib/helpers/time.rb
Wout Schellaert 637e5c1ae2
Add inschrijflink for start of academic year (#275)
* Add inschrijflink for start of academic year

* Rely on autoprefixer
2018-09-24 18:18:47 +02:00

28 lines
765 B
Ruby

module TimeHelper
def christmastime?
timehelper([[Time.new(Time.now.year, 12, 6), Time.new(Time.now.year, 12, 31)]])
end
def studytime?
year = Time.now.year
timehelper([
[Time.new(year, 12, 14), Time.new(year, 12, 31)],
[Time.new(year, 1, 1), Time.new(year, 2, 7)],
[Time.new(year, 5, 15), Time.new(year, 6, 30)],
[Time.new(year, 8, 5), Time.new(year, 9, 10)]
])
end
def new_member_time?
year = Time.now.year
timehelper([[Time.new(year, 9, 20), Time.new(year, 10, 15)]])
end
def timehelper(ranges)
ranges.any? { |range| periodhelper(*range) }
end
def periodhelper(startdate, enddate)
Time.now.between?(startdate, enddate)
end
end