My question refers to the following bootstrap 3 date time picker:
https://eonasdan.github.io/bootstrap-datetimepicker/
I have a bootstrap 3 date and time picker widget on a website, but would actually like it to be just a time picker.
This is normally trivial to achieve, and can be done using the format parameter as follows:
$('#datetimepicker').datetimepicker({defaultDate:'now',ignoreReadonly: true});
$('#datetimepicker').data("DateTimePicker").format('LT');
Note the LT for local time, or you could use:
$('#datetimepicker').data("DateTimePicker").format('HH:mm:ss');
Both of these work as we've removed any reference to date.
However, my issue is that I use an additional string in my text field, so my code actually looks like this:
$('#datetimepicker').datetimepicker({defaultDate:'now',ignoreReadonly: true});
$('#datetimepicker').data("DateTimePicker").format('[Departing at:] LT');
This comes from my previous question here:
Add custom text to the output text field in bootstrap datetimepicker
This works fine in that the text field shows:
But it still contains a date widget. How can I remove the date widget?
If this isn't possible, is there a way to have the time widget appear first by default, that would suffice.
I should point out that I have tried removing the
defaultDate:'now'
code in case it was forcing the date picker to appear, but that doesn't help.