This repository has been archived on 2020-01-20. You can view files and clone it, but cannot push or open issues or pull requests.
evoresa/app/helpers/item_helper.rb

14 lines
345 B
Ruby

module ItemHelper
def default_dates
[ @date.strftime('%d/%m/%Y'), hour(+0), hour(+1) ].join(' ')
end
def hour(hdelta)
t = Time.now + (hdelta*3600)
q = ((t.min / 60.0) * 4).ceil / 4.0 * 60
hour = (q == 60 ? t.hour + 1 : t.hour).round
min = (q == 60 ? 0 : q ).round
"%02d:%02d" % [hour, min]
end
end