I would like to turn a regular 24 hour time select input into a 12 hour time select with an additional AM/PM select input. For example:
Before:
\[00\.\.23\] : \[00\.\.59\]
After:
\[1\.\.12\] : \[00\.\.59\] \[AM,PM\]
I'm really surprised that this sort of thing doesn't come standard in Rails. Has this been
done before? Is there a plugin or gem that I can install? If not, how can I create this from scratch?
I could easily write the HTML to create a few select elements, however, it's the Ruby part that I am not as familiar with. Could you provide an example of what the controller code (or model, helper, etc) would look like to convert the 3 fields into a valid time value ready to store in a database?
I highly recommend using jQueryUI Datepicker for more usable date selection. However, if you want to have it your way, create fields in your model for all the select boxes, and use the before_save callback to construct the final date field for storing in the database.