Use intl to format price base on region
sanchis opened this issue · comments
Use a advanced feature Intl to format correctly price
const formatter = new Intl.NumberFormat('es-ES', {
style: 'currency',
currency: 'EUR'
})
return formatter.format(price)
Numbers to test.
Price | Expected price |
---|---|
1021,30 | 1021,30 € |
1029 | 1029 € |
1.100,95 | 1100,95 € |
1149.0 | 1149 € |
27.49 | 27,49 € |
44.94 | 44,94 € |
Use intl tool to generate the correct format to prices.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat
Create a common function to format all prices from all parser shops.