Posted on 09/10/2024 12:13:15
Wonders of tech...
The price in the list is formatted using .NET string formatting, specifically ToString("N2") in whatever culture the server is running.
When editing we are using an input type=number (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/number) and how that behaves is handled by the browser. I think the default browser behavior is to use your machines locale - my machine is in Danish and shows 259,99 in the editor.
Some browsers support lang="en" on the input editor to control the decimal delimiter, but not Chrome. So we do not use it.
The font applied on the list is a UX decision. We have a specific column type for showing price and percentage related information that uses a monospace font. This is to ensure that all characters are the same width so it is easy to read a list of prices stacked on top of each other and each number is stacked exactly on top of each other. They are always right aligned and always have 2 decimals (with exceptions). Also the monospace highlights the delimiters so the numbers are faster to read and decipher.
You can see it here:
- Normal font
- 1.111,11
- 2.333,33
- 3.111,11
- 5.655,66
- Monospace font
- 1.111,11
- 2.333,33
- 3.111,11
- 5.655,66
The list of orders with monospace font:
And using the regular font
For listing price numbers in the list, e.g. the price list, we have discussed using the currency culture info to handle formatting - so if it is DKK using DA-DK, it would use danish formatting and if it is USD using EN-US, it would use american formatting. The problem is that you would have different number formats in the same list and that can be confusing.
Prices using currency formats:
- EUR 1.234,56
- USD 1,234.55
BR Nicolai