smalot / bootstrap-datetimepicker

Both Date and Time picker widget based on twitter bootstrap (supports Bootstrap v2 and v3)
http://www.malot.fr/bootstrap-datetimepicker/
Apache License 2.0
3.49k stars 1.65k forks source link

datetimepicker is not a function #654

Open ejlocop opened 7 years ago

ejlocop commented 7 years ago

Hi guys. anyone knows how to use this package using webpack to bundle it?

i am trying to use this in my Vue component but unfortunately. i can't seem to work it.

here's my example codes.

import datetimepicker from 'bootstrap-datetime-picker';

main () {
 $.fn.datetimepicker = datetimepicker;
}

but it's seems like it's exporting an empty Object.

any help would be appreciated, Thanks!

devope commented 7 years ago

Try to follow this steps

  1. Download bootstrap-datetimepicker.js
  2. Place all files like this: app/assets/js/vendor/smalot/bootstrap-datetimepicker.js
  3. In your module (script) write like this import './vendor/smalot/bootstrap-datetimepicker.js';

Eventually folders structure must be like this: app -- assets ---- js ------ app.js (where you do import) ------ vendor -------- smalot ---------- bootstrap-datetimepicker.js (downloaded file)

It works for me, btw. And don't forget to use jQuery with this library.