demersus/formtastic_datepicker_inputs — Issue #9: Use different class names for datetime fields and date fields
Author: theodorton
Created: 2011-12-14 13:22:32+00:00
State: open

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'
});
});
````