Tuesday, 20 August 2013

Why is the time field in a Rails 4 form showing seconds and microseconds?

Why is the time field in a Rails 4 form showing seconds and microseconds?

I have a model with a datetime attribute.
The form to create a new model separates this attribute into a date and a
time field, which the controller glues together afterwards.
On Chrome, this works fine and when I go to make a new model (load 'new'
form using a new object with a DateTime.current attribute), the time comes
up in the form field as as '09:00' as intended. However, on Safari and
Firefox I get '09:00:00.000', which breaks my tests and looks odd.
How can I make the time inputs load with HH:mm instead of HH:mm:ss:mmm?

No comments:

Post a Comment