angularmomentjseonasdan-datetimepicker

require moment define.AMD not working after publishing


I have an issue with a library I used. The header of the file is:

(function (factory) {
    'use strict';
    if (typeof define === 'function' && define.amd) {
        // AMD is used - Register as an anonymous module.
        define(['jquery', 'moment'], factory);
    } else if (typeof exports === 'object') {
        module.exports = factory(require('jquery'), require('moment'));
    } else {
        // Neither AMD nor CommonJS used. Use global variables.
        if (typeof jQuery === 'undefined') {
            throw 'bootstrap-datetimepicker requires jQuery to be loaded first';
        }
        if (typeof moment === 'undefined') {
            throw 'bootstrap-datetimepicker requires Moment.js to be loaded first';
        }
        factory(jQuery, moment);
    }
}(function ($, moment) {

The issue online is that moment.locale() is not a function.

With a breakpoint in the console, I have:

printscreen

My application is an Angular one and I didn't make any big change on my version of moment neither the library I used.

Anyone can point me on what I should check now because I'm loosing a lot of time on this ?


Solution

  • My project is on Vuejs and I use bootstrap-datetimepicker too. It was working well before updating momentjs to 2.25.2. Now I see the same error.

    Temporary workaround is to downgrade momentjs to 2.24.0.