-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Documentation incorrect: lang().months returns function rather than months array #682
Comments
You're correct, the docs are wrong.
You can post issues with the documentation to: https://github.com/timrwood/momentjs.com. https://github.com/timrwood/momentjs.com/issues/25 here's one :) |
@ichernev, while this works for most languages, for some, such as Ukrainian and Russian (maybe a few other languages as well), moment().lang('ru');
var ru = moment().lang();
ru._months; //["January", "February", ... ] instead of ["январь", "февраль", ...] |
The This was added to allow languages to change between different cases of the month name depending on where in the formatting string the month name fell. Perhaps that should be outlined in the docs as well. |
If I'm not mistaken, by looking at the code, so far only 3 translations (Russian, Ukrainian and Georgian (ka)) actually override this method. The rest just use nominative case all the time (for now). Anyway, IMO, using |
Yeah, its probably best to use something like this instead of directly trying to access the array. moment.lang().months(moment([0, monthIndex]), ""); |
So how should one get the list of weekdays or months to populate a list for selection? |
2 years later and the doc is still wrong... |
Documentation states:
but on a Node.js REPL:
Side note: executing the function throws an error
The text was updated successfully, but these errors were encountered: