formtastic_datepicker_inputs icon indicating copy to clipboard operation
formtastic_datepicker_inputs copied to clipboard

Use different class names for datetime fields and date fields

Open theodorton opened this issue 13 years ago • 0 comments

It's a problem that you'd have to use custom class names in order to have both a date field and a datetime field on the same page. Am I missing something here or should the two fields have different class-names in order for the jQuery to work?

    = f.input :started_at,  as: :datetime_picker,
      input_html: { class: 'datetime-field' }
    = f.input :ends_at,     as: :datetime_picker,
      input_html: { class: 'datetime-field' }
    = f.input :expires_on,  as: :date_picker,
      input_html: { class: 'date-field' }
      (function($){
        $(document).ready(function(){
          $('input.date-field').datepicker({
            firstDay: 1,
            dateFormat: 'yy-mm-dd'
          });
          $('input.datetime-field').datetimepicker({
            firstDay: 1,
            dateFormat: 'yy-mm-dd',
            timeFormat: 'hh:mm:ss'
          });
        });

theodorton avatar Dec 14 '11 13:12 theodorton