Ideas

Give us your best ideas!

Change package Globalize to standard Intl.NumberFormat

In services/formService.ts you are using an outdated package for formatting numbers. Instead you can use https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat


I suggest the following
```

export function formatDecimalValue(culture: string, value: string) { return Intl.NumberFormat(culture).format(parseFloat(value)) ?? NaN;}

  • Mats Olsberg
  • Oct 24 2024
  • Attach files
  • Ton Nguyen commented
    11 Nov 11:51

    You are right, the package should be updated. However, Globalization.parseFloat and Intl.NumberFormat are doing different things. Intl.NumberFormat formats a number to a localized string, while Globalization.parseFloat parses a localized string into a float number.