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
updateLocale does not keep the correct predefined locale but overwrites with default (en) #3626
updateLocale does not keep the correct predefined locale but overwrites with default (en) #3626
Comments
Update: When the locale that is to be changed has been explicitly used prior to the 'changeUpdate' function call, the update works correctly: var moment = require('moment');
var date1 = moment('2011-02-02');
date1.locale('de');
console.log(date1.format('YYYY MMM MMMM'));
//output: 2011 Febr. Februar
moment.updateLocale('de', {monthsShort: ["JAN", "FEB", "MÄR", "APR", "MAI", "JUN", "JUL", "AUG", "SEP", "OKT", "NOV", "DEZ"]});
var date = moment('2011-02-02');
date.locale('de');
console.log(date.format('YYYY MMM MMMM'));
//output: 2011 FEB Februar |
Looks like a bug to me. I can't really comment on your specific proposed fix without spending some more time, but in general we'd take a PR for this. |
Been looking at bugs to work on and I see this one is still apparent and can still be reproduced. I've refactored the above suggested solution and submitted a PR. |
[bugfix] updateLocale now tries to load parent, fixes #3626
Description of the Issue and Steps to Reproduce:
I wanted to update the 'monthShort' of the german Locale with the follwoging code:
Expected would be an output of '2011 FEB Februar', instead the output is '2011 FEB February'.
When updateing the 'monthsShort' key in the locale definition the resulting locale is not based on the german definition anymore but on the english Definition, hence 'Febraury' instead of 'Februar'.
Environment:
Node 6.3.1 on LInux
Other information that may be helpful:
If you are reporting an issue, please run the following code in the environment you are using and include the output:
Mon Nov 28 2016 11:23:45 GMT+0100 (STD)
2016-11-28 11:23:45
-60
//omitted the 'navigator' potion
2.17.0
The text was updated successfully, but these errors were encountered: