Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a 12 hour (with AM/PM) time select element?

I am using rails 3.2.13. I want to show 12 hours of clock and am/pm also in dropdown. Seems lot of people talking about this but there is no inbuilt solution for the same.

time_select("post", "written_on", {:ampm => true})  # it gives me just two dropdowns. No dropdown for am/pm
f.time_select :written_on, :ampm => true  # same here. No third dropdown for am/pm

Any suggestions?

like image 799
Mohit Jain Avatar asked Nov 03 '22 00:11

Mohit Jain


1 Answers

It's best to just delegate this to a good client side JS library. Below is what I personally use for my clients; it's awesome.

http://amsul.ca/pickadate.js/

like image 105
jbearden Avatar answered Nov 09 '22 10:11

jbearden