fix(dashboard): support more decimals for tx rates (#13407)

* Percentage formatter set maximum digits to 4

* Modify Tax Region Forms to allow 4 digits tax rates

* Add changeset

* Revert placeholder value to use only 2 decimals

* fix(dashboard): support more decimals for tx rates

* changeset

* bypass scale

* refactor

* fix removal of deprecated input

* cleanup deprecated percentage input

* small mistake in onchange

* add deprecated percentage input back

* import

* remove file extension

* frane comment

---------

Co-authored-by: AmbroziuBaban <ambroziubaban@gmail.com>
This commit is contained in:
William Bouchard
2025-09-05 07:02:44 -04:00
committed by GitHub
parent 0000ed6998
commit 9b3831d258
10 changed files with 102 additions and 41 deletions

View File

@@ -0,0 +1,19 @@
/**
* Gets the number of decimal places in a number
* @param num - The number for which we are getting the number of decimal places
* @returns The number of decimal places
*
* @example
* getDecimalPlaces(123.456) // 3
* getDecimalPlaces(42) // 0
* getDecimalPlaces(10.0000) // 0
*/
export function getNumberOfDecimalPlaces(num: number): number {
// Convert to string and check if it contains a decimal point
const str = num.toString()
if (str.indexOf(".") === -1) {
return 0
}
// Return the length of the part after the decimal point
return str.split(".")[1].length
}

View File

@@ -1,6 +1,7 @@
const formatter = new Intl.NumberFormat([], {
style: "percent",
minimumFractionDigits: 2,
maximumFractionDigits: 4,
})
/**