javascript - Get warning deprecation : moment.updateLocale(); at moment-with-locales js - Stack Overflow

I got warning deprecation in firefox when i use moment-with-locales.min.js and can't to use local

I got warning deprecation in firefox when i use moment-with-locales.min.js and can't to use local languange with this warning .

Here is the message from console :

      "Deprecation warning: use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See / for more info."

How i can fix this ? Thank.

I got warning deprecation in firefox when i use moment-with-locales.min.js and can't to use local languange with this warning .

Here is the message from console :

      "Deprecation warning: use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs./guides/#/warnings/define-locale/ for more info."

How i can fix this ? Thank.

Share Improve this question asked Sep 2, 2017 at 9:24 user8455694user8455694 2703 silver badges12 bronze badges 3
  • What happens when you use moment.updateLocale(localName, config) as instructed? – Darren H Commented Sep 2, 2017 at 9:30
  • The problem is that warning at moment-with-locales.min.js and very very many defineLocale function at those js, so imposibble for me to change all defineLocale function to updateLocale – user8455694 Commented Sep 2, 2017 at 9:37
  • I'd misunderstood, I thought you were calling the method yourself. The issue appears to have been fixed in github./ffrgb/meshviewer/issues/96 are you using an up to date version? – Darren H Commented Sep 2, 2017 at 9:52
Add a ment  | 

3 Answers 3

Reset to default 2

Find the script which is calling the moment.js that throws this warning. Edit your script and search for ".defineLocale(" then replace with ".updateLocale(".

At the time of config the locale, if it was as follows:

moment.locale("fr", fr);

change it to:

moment.locale("fr");

You also no longer need to add language file directly to your document.

Answer I see always told us to change the function where is defineLocale() used. The thing I see is (in my project) I'm not using this function, is the proper moment.js who uses it. Although is not remended to modify this file, I've tried to see what happens but...

Deprecation warning: use moment.updateLocale(localeName, config) to change an existing locale. moment.updateLocale(localeName, config) should only be used for creating a new locale See http://momentjs./guides/#/warnings/define-locale/ for more info.

This appears to be a bug and is not supposed to be fixed as Moment.js is in maintenance mode, so the only workaround is to switch to another dependency. Good luck!

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744835791a4596254.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信