Last active
August 24, 2023 11:51
-
-
Save Kobe/1236663147c917669f54b5804f2a1c2d to your computer and use it in GitHub Desktop.
price formatting by Intl API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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