Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught (in promise) Error: Tempus Dominus Bootstrap4's requires moment.js. Moment.js must be included before Tempus Dominus Bootstrap4's JavaScript. Meteor #204

Open
nosizejosh opened this issue Sep 26, 2018 · 8 comments

Comments

@nosizejosh
Copy link

Not sure why but the datepicker cannot seem to find the installed and properly imported moment. I have tried many variations and all still lead to missing moment errorr, meanwhile moment is used on same page and it works fine.

import moment from 'moment';
// moment = require('moment');
// import moment from 'moment-timezone';
import 'tempusdominus-bootstrap-4';
// Import this component
import datetimepicker from 'tempusdominus-bootstrap-4';

// Import date picker css
// import 'tempusdominus-bootstrap-4/build/css/tempusdominus-bootstrap-4.min.css';

Keep getting errror below

Uncaught (in promise) Error: Tempus Dominus Bootstrap4's requires moment.js. Moment.js must be included before Tempus Dominus Bootstrap4's JavaScript.

image

Also why does this need a wrapper for meteor? as an npm package it should work with meteor seemlessly, so whats the problem? any one here with a solution please?

@ordersfg
Copy link

ordersfg commented Nov 2, 2018

VERY DISAPPOINTED in this datepicker. Buggy as HELL.

@Eonasdan
Copy link
Contributor

Eonasdan commented Nov 4, 2018

then don't use it @ordersfg. feel free not come back

@victorvbello
Copy link

If you use Webpack, you can add in your config, this:

new webpack.ProvidePlugin({ moment: "moment" })

It works for me

@shibbirweb
Copy link

That's works for me in laravel.
don't forget to add font awesome.

require('./bootstrap');

window.Vue = require('vue');
window.Event = new Vue();

/**
 * Import moment js
 */
import moment from 'moment';
Vue.prototype.moment = moment;
window.moment = moment;

/**
 * Import datetimepicker
 */
require('tempusdominus-bootstrap-4');

// Import date picker css
import 'tempusdominus-bootstrap-4/build/css/tempusdominus-bootstrap-4.min.css';

JQuery already added in bootstrap.js

Screenshot_1

@wilberforce
Copy link

For rollup:

import-modules.js:

import jquery from "jquery";
import moment from 'moment';
export default (window.$ = window.jQuery = jquery,window.moment = moment);

entry.js

import "./import-modules";

import bootstrap from 'bootstrap';
import 'tempusdominus-bootstrap-4';

import validate from 'jquery-validation';

...

@leocxy
Copy link

leocxy commented Apr 2, 2020

For rollup:

import-modules.js:

import jquery from "jquery";
import moment from 'moment';
export default (window.$ = window.jQuery = jquery,window.moment = moment);

entry.js

import "./import-modules";

import bootstrap from 'bootstrap';
import 'tempusdominus-bootstrap-4';

import validate from 'jquery-validation';

...

@wilberforce Your solution is working for me. I am using browserify...

@wukong1024
Copy link

For rollup:

import-modules.js:

import jquery from "jquery";
import moment from 'moment';
export default (window.$ = window.jQuery = jquery,window.moment = moment);

entry.js

import "./import-modules";

import bootstrap from 'bootstrap';
import 'tempusdominus-bootstrap-4';

import validate from 'jquery-validation';

...

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants