Bootstrap Datetime Picker not working with Bootstrap 4 Alpha 6

nivas picture nivas · Feb 9, 2017 · Viewed 13.2k times · Source

We are using Eonasdan Datetime picker. We are migrated to Boostrap 4 Alpha 6 since it comes with lot of improvements over Alpha5 but Datetime picker broken. Now it's not showing the numbers when we click on calendar icon in datetime picker.But it's working with alpha 5.I am looking for a possible way to solve this.

Answer

sr9yar picture sr9yar · Mar 6, 2017

Classes collapse in classes were changed into collapse show, that's why the code became incompatible.

in your vendor\eonasdan\bootstrap-datetimepicker\src\js\bootstrap-datetimepicker.js

getTemplate:

if (hasDate()) {
 content.append($('<li>').addClass((options.collapse && hasTime() ? 'collapse in' : '')).append(dateView));

Change to:

if (hasDate()) {
  content.append($('<li>').addClass((options.collapse && hasTime() ? 'collapse show' : '')).append(dateView));
  }

togglePicker:

   expanded = $parent.find('.in'),
  closed = $parent.find('.collapse:not(.in)'),

and

   } else { // otherwise just toggle in class on the two views
     expanded.removeClass('in');
     closed.addClass('in');

Change to:

 expanded = $parent.find('.show'),
 closed = $parent.find('.collapse:not(.show)'),

and

  } else { // otherwise just toggle in class on the two views
  expanded.removeClass('show');
 closed.addClass('show');

Source