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

TypeError: moment.defineLocale is not a function Umbraco 7.10 #56

Open
bindles1 opened this issue May 19, 2018 · 3 comments
Open

TypeError: moment.defineLocale is not a function Umbraco 7.10 #56

bindles1 opened this issue May 19, 2018 · 3 comments

Comments

@bindles1
Copy link

TypeError: moment.defineLocale is not a function
Line 12: /umbraco/lib/moment/en-gb.js

var en_gb = moment.defineLocale('en-gb', {

This error stops any sort of calendar functionality from working. i.e. can't set future publish dates on pages.

@MrCosmo
Copy link

MrCosmo commented May 30, 2018

I'm having the same issue

@MartijnRasenberg
Copy link

See moment/momentjs.com#171
The version of moment.js this plugin pushes is 2.4.0 (try console.log(moment.version)), support for moment.locale() is added @ 2.8.0.
Umbraco now uses 2.10.x, but the plugin version is loaded after the umbraco version and thus overrides it.
If you empty (clear all content) from \App_Plugins\Analytics\lib\momentjs\moment.js the version included in this package is not loaded, and the error is not shown.
But...the package is not working afterwards.

@Emetico
Copy link
Contributor

Emetico commented Jun 15, 2018

I got the same issue in Umbraco 7.10.4.

I removed '~/App_Plugins/Analytics/lib/momentjs/moment.js' , from App_Plugins/Analytics/package.manifest. And the plugin still seems to work as expected.

Still i think this issue should be fixed. Maybe load it via assetsService.loadJs() instead of putting it in the package manifest?

~/App_Plugins/Analytics/backOffice/directives/DateRangePicker.Directive.js

assetsService.loadJs('~/App_Plugins/Analytics/lib/momentjs/moment.js').then(function () {
    element.daterangepicker(..
});

Emetico added a commit to Emetico/Analytics that referenced this issue Sep 4, 2018
TypeError: moment.defineLocale is not a function Umbraco 7.10 umbraco-community#56

umbraco-community#56

Removed ~/App_Plugins/Analytics/lib/momentjs/moment.js from package.config.

Added assetsService to dateRangePicker directive to load moment.js before executing daterangepicker.
warrenbuckley pushed a commit that referenced this issue Feb 19, 2019
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

4 participants