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

List loaded locales #2932

wants to merge 2 commits into
base: develop


None yet
5 participants

jisaacks commented Jan 31, 2016

Fixes #843

This adds the method moment.locales() to get an array of the locales that have been loaded (ie, bundled with moment.js or manually required in node.)

It does not list or require available (but unloaded) locales in node. I think that should be a separate feature if needed at all.


This comment has been minimized.


mj1856 commented Feb 2, 2016

LGTM. Staging for next release. Thanks!

@@ -152,6 +152,10 @@ test('defineLocale', function (assert) {
assert.equal(moment().locale('dude').locale(), 'dude', 'defineLocale defines a locale');
test('locales', function (assert) {
assert.equal(moment.locales().length > 0, true, 'locales returns an array of defined locales');

This comment has been minimized.


mj1856 Feb 2, 2016


It would be nice to see a smarter test here. Test for content, at least for English, and perhaps include one custom locale (like dude shown in the test above)


This comment has been minimized.


ichernev commented Mar 6, 2016

Merged in c0519b5

@ichernev ichernev closed this Mar 6, 2016

ichernev added a commit that referenced this pull request Mar 6, 2016


This comment has been minimized.

Silviu-Marian commented Feb 27, 2017

Should this be in the docs too? I'm asking because I wasn't able to find any references to it


This comment has been minimized.

fracz commented Aug 25, 2017

The method is

let locales = moment.locales(); // ['en', 'ru', 'pl']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment