Skip to content

Instantly share code, notes, and snippets.

@letanure
Last active July 24, 2019 17:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save letanure/86731fa5ba64b07f4aa59b92a84b8975 to your computer and use it in GitHub Desktop.
Save letanure/86731fa5ba64b07f4aa59b92a84b8975 to your computer and use it in GitHub Desktop.
create array months in any language πŸ˜›
[...Array(12)].map((item, index) => ( new Date(Date.UTC(0, ++index, 0, 0, 0, 0)).toLocaleDateString('de-DE', { month: 'long' }) ))
Object.assign(...[...Array(12)].map((item, index) => new Date(Date.UTC(0, ++index, 0, 0, 0, 0)).toLocaleDateString('pt-BR', { month: 'long' })).map((month, index) => ({[index]: month})))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment