Skip to content

Instantly share code, notes, and snippets.

@Kobe
Last active August 24, 2023 11:51
Show Gist options
  • Save Kobe/1236663147c917669f54b5804f2a1c2d to your computer and use it in GitHub Desktop.
Save Kobe/1236663147c917669f54b5804f2a1c2d to your computer and use it in GitHub Desktop.
price formatting by Intl API
const price = 123456.789;
console.log({"de-DE": new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(price)});
console.log({"de-AT": new Intl.NumberFormat('de-AT', { style: 'currency', currency: 'EUR' }).format(price)});
console.log({"en-GB": new Intl.NumberFormat('en-GB', { style: 'currency', currency: 'GBP' }).format(price)});
console.log({"fr-FR": new Intl.NumberFormat('fr-FR', { style: 'currency', currency: 'EUR' }).format(price)});
console.log({"it-IT": new Intl.NumberFormat('it-IT', { style: 'currency', currency: 'EUR' }).format(price)});
console.log({"es-ES": new Intl.NumberFormat('es-ES', { style: 'currency', currency: 'EUR' }).format(price)});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment