jQuery-Timepicker-Addon icon indicating copy to clipboard operation
jQuery-Timepicker-Addon copied to clipboard

Changing time format on the fly

Open TheCelavi opened this issue 12 years ago • 1 comments
trafficstars

Changing time format of time picker is not possible after time picker is initialized.

TheCelavi avatar Jun 26 '13 11:06 TheCelavi

You can by recreating the picker:

$timeInputs.each((_, input) => {
  const time = $(input).datetimepicker('getDate'); // .timepicker('getDate') doesn't work
  $(input)
    .timepicker('destroy')
    .timepicker({
      timeFormat: 'your new format',
      // all the other required timepicker options
    })
    .timepicker('setDate', time);
});

Finesse avatar May 29 '20 11:05 Finesse