explore/posts/popular: refactor post previews.

This commit is contained in:
evazion
2020-01-12 22:57:40 -06:00
parent 74ce866890
commit 12a845de92
7 changed files with 76 additions and 182 deletions

View File

@@ -0,0 +1,23 @@
module PopularPostsHelper
def next_date_for_scale(date, scale)
case scale
when "day"
date + 1.day
when "week"
date + 1.day
when "month"
1.month.since(date)
end
end
def prev_date_for_scale(date, scale)
case scale
when "day"
date - 1.day
when "week"
date - 7.days
when "month"
1.month.ago(date)
end
end
end