zpaulovics / datetimepicker-rails

A date and time picker for Twitter Bootstrap in Rails using Simple Form
MIT License
174 stars 80 forks source link

js is not overriding defaults by locales/en.yml #60

Open kikocastro opened 9 years ago

kikocastro commented 9 years ago

Hello,

I get the locales/en.yml to work. What I can't do is to override the options. For instance:

locales/en.yml

timepicker:
  dformat: '%l:%M %
  pformat: 'HH:mm A'

With this the time picker works ok ( 11:28 PM) But when I try to customize it in a certain page

example_page.js

//= require moment
//= require bootstrap-datetimepicker
//= require pickers

$(document).on('ready page:change', function() {
  $('datetimepicker').datetimepicker({
    format: 'HH:mm'
  });
});

The format won't be overridden. With the options directly on simple form it also won't change the locales format.

= f.input :trip_duration, as: :time_picker, as: :time_picker, input_html: { data: { date_options: { format: 'HH:mm'} } }

Is that overriding possible?