Update Winter Sale banner for last day.

This commit is contained in:
evazion
2020-12-31 06:34:51 -06:00
parent d9a8fc99bc
commit 83d6cd5980
4 changed files with 18 additions and 17 deletions

View File

@@ -108,13 +108,17 @@ module ApplicationHelper
tag.time content || datetime, datetime: datetime, title: time.to_formatted_s, **options
end
def humanized_duration(from, to)
def humanized_duration(from, to, compact: false)
if to - from > 10.years
duration = "forever"
else
duration = distance_of_time_in_words(from, to)
end
if compact
duration = duration.gsub(/almost|about|over/, "").gsub(/less than a/, "<1").strip
end
datetime = from.iso8601 + "/" + to.iso8601
title = "#{from.strftime("%Y-%m-%d %H:%M")} to #{to.strftime("%Y-%m-%d %H:%M")}"