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

Set locale for moment js with different version #5284

Closed
grkov90 opened this issue Feb 20, 2018 · 1 comment
Closed

Set locale for moment js with different version #5284

grkov90 opened this issue Feb 20, 2018 · 1 comment

Comments

@grkov90
Copy link

grkov90 commented Feb 20, 2018

moment = typeof moment === 'function' ? moment : window.moment;

Hello ! )

Project structure:

 app/
    main.js
    /node_modules
      /moment — version 2.19
      /chart.js
        /node_modules
          /moment — version 2.18

Simple code. But not work.

// main.js
import 'moment';
import 'moment/locale/ru';
moment.locale('ru');

'scale.time.js' from Chart.js works with 'en' locale.

scale.time.js have self 'moment' instance, different from app 'moment' instance.

global variables is evil

I think need write:

moment = window.moment || moment ;
if (!moment) throw new Error...
@etimberg
Copy link
Member

I think this is covered by #2906 and other related issues

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

No branches or pull requests

2 participants