I think using a calendar or datetime_select helper is a good way, as it will fix some formatting problems that may occur with inputs (date formats are not standardized around the world, using AM / PM or 24H, etc.).
And by breaking it, you can do most of the work automatically. Say, for example, that you have your own attribute :start_time , then you create a field for start_time(1i) for the year, start_time(2i) for the month, start_time(3i) for the day, etc., And when passing to the ActiveRecord model it will put it automatically in datetime.
source share