mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
Updated currency field to prevent floating point issues (#19221)
refs ADM-54
This commit is contained in:
parent
ede2d9c1b7
commit
b450db557b
1 changed files with 1 additions and 1 deletions
|
@ -26,7 +26,7 @@ const CurrencyField: React.FC<CurrencyFieldProps> = ({
|
||||||
|
|
||||||
// The saved value is strictly a number with 2 decimal places
|
// The saved value is strictly a number with 2 decimal places
|
||||||
const forceCurrencyValue = (input: string) => {
|
const forceCurrencyValue = (input: string) => {
|
||||||
return Math.floor(parseFloat(input.match(/[\d]+\.?[\d]{0,2}/)?.[0] || '0') * 100);
|
return Math.round(parseFloat(input.match(/[\d]+\.?[\d]{0,2}/)?.[0] || '0') * 100);
|
||||||
};
|
};
|
||||||
|
|
||||||
return <TextField
|
return <TextField
|
||||||
|
|
Loading…
Add table
Reference in a new issue