fix(admin-ui): Preserve decimal numbers when locale uses commas (#5641)

**What**
- Ensure that we format numbers with `.` as the decimal separator, even when the users locale uses `,`. This changes still allows users to use comma as the decimal separator, but the transformation we use before writing to state converts the number to use a dot instead.
This commit is contained in:
Kasper Fabricius Kristensen authored and GitHub committed 2023-11-15 17:18:26 +00:00
1 parent a2a45b6fef
commit c08240df3f
2 files changed
+6

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
---
"@medusajs/admin-ui": patch
---
fix(admin-ui): Resolves an issue where decimal numbers would be stripped when the locale uses commas as the decimal separator
@@ -1830,6 +1830,7 @@ const Cell = React.forwardRef<HTMLInputElement, CellProps>(
? formatValue({ ? formatValue({
value: strippedValue.replace(/,/g, "."), // If the current locale uses commas as decimal separators, then we need to replace them with dots. value: strippedValue.replace(/,/g, "."), // If the current locale uses commas as decimal separators, then we need to replace them with dots.
decimalScale: decimalScale ?? 0, decimalScale: decimalScale ?? 0,
decimalSeparator: ".",
disableGroupSeparators: true, disableGroupSeparators: true,
}) })
: "" : ""