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
moment().format() incorrect on older browsers #4803
Comments
Please can you run the code below and tell us the output: var date = "1983-04-01";
var ruDate = moment(date, 'YYYY-MM-DD');
console.log(moment.version, moment.locale(), ruDate.toISOString(), ruDate.toDate().toString()); |
moment.version: "2.2.1" |
moment 2.2.1 - from September 2013? You should probably upgrade and see if the bug is fixed in a more recent version of moment. |
Tried latest version: moment.version: "2.22.2"
moment.locale(): "ru"
toISOString: "1983-03-31T19:00:00.000Z"
toDate: "Thu Mar 31 1983 23:00:00 GMT+0400 (KUYT)" |
Interesting. Daylight savings time started at midnight beginning 1st April 1983, so clocks moved forward to 1AM. moments represent a date and a time. 1983-04-01 is effectively shorthand for trying to create a moment at 00:00:00 in local time. But, that date + time doesn't exist in your locale. This sounds very similar to a Brazil DST issue, so this might be fixed if PR #4338 gets merged. |
I think this is working now (2.24.0). Please re-open if you still have issues. |
Description of the Issue and Steps to Reproduce:
When converting to 'DD.MM.YYYY' format some rare dates becomes new, not equal to the initial
http://jsfiddle.net/f3jus6cn/
Environment:
Reproduced this on Chromium 35 and Firefox 45.9.0
OS: Gentoo 2.2
Other information that may be helpful:
The text was updated successfully, but these errors were encountered: