dawarich/app/helpers/application_helper.rb

19 lines
498 B
Ruby
Raw Normal View History

module ApplicationHelper
2024-01-03 06:13:00 -05:00
def classes_for_flash(flash_type)
case flash_type.to_sym
when :error
'bg-red-100 text-red-700 border-red-300'
else
'bg-blue-100 text-blue-700 border-blue-300'
end
end
2024-03-23 15:29:55 -04:00
def url_time(stat)
month = DateTime.new(stat.year, stat.month).in_time_zone(Time.zone)
start_at = month.beginning_of_month.to_time.strftime('%Y-%m-%dT%H:%M')
end_at = month.end_of_month.to_time.strftime('%Y-%m-%dT%H:%M')
{ start_at:, end_at: }
end
end