This repository was archived by the owner on Jul 24, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 57
datepicker (drop down calendar)
dgoerger edited this page Jun 18, 2012
·
3 revisions
https://github.com/albertopq/jquery_datepicker
Added to Reservations/rails3_upgrade branch on 2012.06.12 by @dgoerger in order to give a popup calendar for selection of start_date and due_date.
<%= datepicker_input "[model_name, e.g. user]", "[name of datafield, e.g. birthday]" :value => cart.start_date.strftime('%m/%d/%Y') %>
- Gemfile => gem 'jquery_datepicker'
- application.js => require jquery, jquery-ujs, jquery-ui (on separate lines, in that order)
- views/reservations/_cart_sidebar.html.erb, in the above syntax
- views/catalog/_quicksearch.html.erb, in the above syntax
- controllers/application_controller.rb, the update_cart function
- controllers/catalog_controller.rb, the update_cart* function
- If dataTables is broken, datepicker might be, also. Fixing dataTables seems to resolve the issue.
- We need to make sure in the controller to indicate that the datepicker input is in the format '%m/%d/%Y' format. If not, rails will assume it's in '%d/%m/%Y' format and give errors for any inputted day past twelve (since there are not thirteen months).
- If you modify Datepicker formatting (e.g. we disable selection of dates-past), set the defaults in application.js like this: $.datepicker.setDefaults({ minDate: new Date(), prevText: '' });