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
2023-11-15 18:18:26 +01:00
committed by GitHub
parent a2a45b6fef
commit c08240df3f
2 changed files with 6 additions and 0 deletions

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

View File

@@ -1830,6 +1830,7 @@ const Cell = React.forwardRef<HTMLInputElement, CellProps>(
? formatValue({
value: strippedValue.replace(/,/g, "."), // If the current locale uses commas as decimal separators, then we need to replace them with dots.
decimalScale: decimalScale ?? 0,
decimalSeparator: ".",
disableGroupSeparators: true,
})
: ""