Skip to content

Instantly share code, notes, and snippets.

@mselmany
Forked from yairEO/jsbin.nujus.js
Created April 26, 2020 09:33
Show Gist options
  • Select an option

  • Save mselmany/dcfd64c9de9d87e4fc3df24e171444d3 to your computer and use it in GitHub Desktop.

Select an option

Save mselmany/dcfd64c9de9d87e4fc3df24e171444d3 to your computer and use it in GitHub Desktop.
auto-generates month names in any locale
var months = [];
for( var i = 0; i < 12; i++ ){
months.push( new Date(0,i).toLocaleString({},{month:'short'}) );
// you can also pass a local like : "en-US" instead of an empty object `{}`.
// an empty object triggers the system's auto-detection
}
console.log(months);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment