You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
511 B
17 lines
511 B
2 years ago
|
module CollectionTimeHelper
|
||
|
def current_collection_start_year
|
||
|
today = Time.zone.now
|
||
|
window_end_date = Time.zone.local(today.year, 4, 1)
|
||
|
today < window_end_date ? today.year - 1 : today.year
|
||
|
end
|
||
|
|
||
|
def collection_start_date(date)
|
||
|
window_end_date = Time.zone.local(date.year, 4, 1)
|
||
|
date < window_end_date ? Time.zone.local(date.year - 1, 4, 1) : Time.zone.local(date.year, 4, 1)
|
||
|
end
|
||
|
|
||
|
def current_collection_start_date
|
||
|
Time.zone.local(current_collection_start_year, 4, 1)
|
||
|
end
|
||
|
end
|