Dan Dascalescu
Dan Dascalescu

Reputation: 152095

List of JavaSscript Date toLocaleDateString datetime formats

Where can the official list of Date.prototype.toLocaleDateString formats be found? It's not linked from that MDN page, and the accepted answer to this confusingly phrased question lists a different set of formats. The CLDR database is hard to consume.

What I want is a simple map, like the one below:

const date = new Date();
for (const locale of ['en-US', 'en-GB', 'en-CA'])
  console.log(locale, '=>', date.toLocaleDateString(locale, {  }));

Bonus points for passing { month: 'short' } instead of an empty options object.

Upvotes: 8

Views: 9304

Answers (1)

Adeyemi Simeon
Adeyemi Simeon

Reputation: 170

Here is the List I found, not exhaustive though.

  1. https://html-shark.com/HTML/LanguageCodes.htm (Covers a lot)
  2. http://www.lingoes.net/en/translator/langcode.htm (backup)

EDITED: a more comprehensive list https://gist.github.com/mlconnor/1887156

Upvotes: 1

Related Questions