ankurk91 / vue-bootstrap-datetimepicker

Vue.js component for eonasdan bootstrap datetimepicker
MIT License
223 stars 66 forks source link

Bootstrap 4 support #9

Closed tomer-amir-vonage closed 7 years ago

tomer-amir-vonage commented 7 years ago

It seems like when using Bootstrap 4 (beta) this plugin does not work properly. Can you please add support?

Thanks

ankurk91 commented 7 years ago

This package depends on http://eonasdan.github.io/bootstrap-datetimepicker/ Which does not support bootstrap 3.

tomer-amir-vonage commented 7 years ago

Hi @ankurk91, Found the issue which prevents this plugin to work with bootstrap 4.

Since bootstrap 4 removed glyphicons in favor of font awesome I had to include both css files in the build folder:

import 'eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.css';
import 'eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker-standalone.css';

This is still not enough since bootstrap-datetimepicker-standalone.css tries to import the glyphicons font files from ../fonts/ which does not exist, and that causes a compilation error for me.

I tried to change the paths to CDN paths to tests, and it seems everything is working this way.

if you could add these files to the build folder that would be awesome!

Thanks!

ankurk91 commented 7 years ago

You can use font-awesome, you have to override font icons config

(function ($) {

  // Set default options for bootstrap datetimepicker
  // @link https://eonasdan.github.io/bootstrap-datetimepicker/

  var overrides = {
    icons: {
      time: 'fa fa-clock-o',
      date: 'fa fa-calendar',
      up: 'fa fa-chevron-up',
      down: 'fa fa-chevron-down',
      previous: 'fa fa-chevron-left',
      next: 'fa fa-chevron-right',
      today: 'fa fa-sun-o',
      clear: 'fa fa-trash',
      close: 'fa fa-remove'
    },
  };

  $.extend(true, $.fn.datetimepicker.defaults, overrides);

})(jQuery);

Above config is global, you can also do it on local basis http://eonasdan.github.io/bootstrap-datetimepicker/Options/#icons