I have recently integrated MomentJS library into my application and have been running into a weird issue. Browser I have to use is IE9.
When I launch the application for the first time with zh-cn locale, I see a few junk characters in place of date and time. When I log out and log in again, then the characters load properly.
I check the encoding on screen and see it is UTF-8 both times. The issue is not consistent. I am at a loss as in what should I do to debug or get to the root of this issue. Any pointers about what I should check would be appreciated.
As Moment. js is not supporting tree shaking, it makes no difference if we use many or 1 methods from it.
js . This library helps you manipulate, validate, and accurately display the date and time according to… In fact moment. js is deprecated, the development team recommends to use date-fns instead.
Since the Moment. js package isn't modularized and, per the threads on Github issues, it won't be done as support is ending and they have termed it a legacy project. This is the primary reason behind those large chunks in the build size.
For integrating the MomentJS library, instead of
<script src="moment-with-locales.js"></script>
use this
<script src="moment-with-locales.js" charset="UTF-8"></script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With