Bootstrap Datetime Picker not working with Bootstrap 4 Alpha 6

后端 未结 2 553
别那么骄傲
别那么骄傲 2020-12-19 09:44

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 sh

相关标签:
2条回答
  • 2020-12-19 10:08

    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

    0 讨论(0)
  • 2020-12-19 10:16

    For display correctly all icons in eonasdan-bootstrap-datetimepicker you can add only the glyphicons to your page using this tag:

    <link rel='stylesheet' href='bower_components/glyphicons-only-bootstrap/css/bootstrap.min.css' />

    or install it with:

    // using npm
    npm install glyphicons-only-bootstrap
    
    // using bower
    bower install glyphicons-only-bootstrap
    

    This help you to show correctly all icons in the component, for correctly display component follow the steps mentioned above for Heretron and sr9yar.

    Obviously you also can copy the fonts from dist folder in boostrap 3 and the css relative to it, but the previously option is generally more fast.

    This is the repository in github of glyphicon-only-bootstrap:

    https://github.com/ohpyupi/glyphicons-only-bootstrap

    Good luck, I hope have help you

    PD: Sorry if my english is wrong. Bye

    0 讨论(0)
提交回复
热议问题