1

Has anyone had any luck in setting the default time in bootstrap datetimepicker? https://eonasdan.github.io/bootstrap-datetimepicker/

I've tried set default time in bootstrap-datetimepicker which is ok for the default date but as soon as you click another date it defaults back to the current time.

I want the date to default to today and time to default to 00:00, but if the user chooses another date then keep the time at 00:00, however they should be allowed to change it to something else.

Many thanks

trevrobwhite
  • 443
  • 1
  • 7
  • 22

1 Answers1

1

Many thanks @Josh Stewart for sending me to the solution, I missed that one: Set default time in bootstrap datetimepicker?

var dateNow = new Date();
$('#current_date').datetimepicker({
    defaultDate:moment(dateNow).hours(0).minutes(0).seconds(0).milliseconds(0)
});

Worked perfectly

trevrobwhite
  • 443
  • 1
  • 7
  • 22