Module: PagesCore::Admin::DateRangeHelper
- Included in:
- AdminHelper
- Defined in:
- app/helpers/pages_core/admin/date_range_helper.rb
Instance Method Summary collapse
Instance Method Details
#date_range(starts_at, ends_at) ⇒ Object
14 15 16 17 18 19 20 |
# File 'app/helpers/pages_core/admin/date_range_helper.rb', line 14 def date_range(starts_at, ends_at) dates = different_year_date_range(starts_at, ends_at) || different_month_date_range(starts_at, ends_at) || different_day_date_range(starts_at, ends_at) || same_day_date_range(starts_at, ends_at) safe_join(dates.map(&:strip), "–".html_safe) end |
#page_date_range(page) ⇒ Object
6 7 8 9 10 11 12 |
# File 'app/helpers/pages_core/admin/date_range_helper.rb', line 6 def page_date_range(page) if page.all_day? date_range(page.starts_at.to_date, page.ends_at.to_date) else date_range(page.starts_at, page.ends_at) end end |