Is moment.js browser independent?

2019-07-10 16:47发布

问题:

Does the javascript time library moment.js function independent of which browser you are using? I've already experienced issues with Javascripts native Date object behaving differently (mostly regarding timezones) between different browsers, specifically Chrome and IE. I've also read other issues with the javascript Date object not being browser agnostic:

-Problem with date formats in JavaScript with different browsers

-javascript date.parse difference in chrome and other browsers

-etc...

Being that momentjs is a javascript library, I would think that it will function the same independent of which browser is executing it.

回答1:

Even though it relies on different ways to provide the same functionality, the behavior should be the same in the browsers they describe in the documentation here:

Moment was designed to work both in the browser and in Node.js.

All code should work in both of these environments, and all unit tests are run in both of these environments.

Currently the following browsers are used for the ci system: Chrome on Windows XP, IE 8, 9, and 10 on Windows 7, IE 11 on Windows 10, latest Firefox on Linux, and latest Safari on OSX 10.8 and 10.11.