Repository navigation
Moment.js Locale Override Mystery - AM/PM Parsing Gone Wrong!" #6414
|
Describe the bug To Reproduce
Expected behavior Wrong behavior Desktop (please complete the following information):
Moment-specific environment
Please run the following code in your environment and include the output: console.log((new Date()).toString()) //'Thu May 16 2024 01:28:31 GMT+0530 (India Standard Time)'
console.log((new Date()).toLocaleString()) //'16/05/2024, 01:28:47'
console.log((new Date()).getTimezoneOffset()) //-330
console.log(process.version)
console.log(moment.version) //'2.30.1' |
Replies: 14 comments
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
In your code example, you're only calling |
This comment has been hidden.
This comment has been hidden.
|
There are already examples in the parsing documentation:
|
In your code example, you're only calling
.locale('en')after the parsing has already happened. That snippet is not trying to parse the string inenlocale; it's trying to parse the string in the global locale then use theenlocale afterwards.