I’m currently building a small app that’s going to be used to keep track
of the amount of time spend on customers of the company I work for.
This mainly consists of object with a begin time, an end time and a
calculation of the difference between those timestamps (actual time
spend on the job).
I made a small form with a datetime_select helper for the begin and end
time (the column type inside the DB is also dateselect). Because the
actual time spend on the job can be less then the difference between
begin and end I want this time to be selectable too. Because this
attribute only holds hours and minutes I tried to use the select_time
helper. Unfortunately there seems to be a small bug in this helper cause
the fieldname that’s being parsed is always date[“name you give to it
using the :field_name option”].
I just tried the datetime_select using the :discard_year and -month
options, but this helper always needs the year selection field (probably
has something to do with the fact that Time.gm() requires at least the
year argument). Although this works (the value inside the ‘time’ column
is nicely being mapped to the ‘time’ field it just doesn’t look right
with the year selection field being displayed.
The question is: is there an easy and elegant way to solve this problem
or will I have to build my own time_select helper using the hour and