From f51d45f90bd3556df7052506893564ec43add8a3 Mon Sep 17 00:00:00 2001 From: akshayantony55 Date: Mon, 30 Oct 2023 01:04:56 +0530 Subject: [PATCH 1/3] fix #5185, InputNumber: Minus Sign not working for Currency INR --- components/lib/inputnumber/InputNumber.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/lib/inputnumber/InputNumber.js b/components/lib/inputnumber/InputNumber.js index 180702c1df..199e8e1bbf 100644 --- a/components/lib/inputnumber/InputNumber.js +++ b/components/lib/inputnumber/InputNumber.js @@ -568,9 +568,11 @@ export const InputNumber = React.memo( const suffixCharIndex = val.search(_suffix.current); _suffix.current.lastIndex = 0; - const currencyCharIndex = val.search(_currency.current); + let currencyCharIndex = val.search(_currency.current); - _currency.current.lastIndex = 0; + if(currencyCharIndex === 0 && _currency.current.toString() === '/[INR]/g'){ + currencyCharIndex = 3 + } return { decimalCharIndex, minusCharIndex, suffixCharIndex, currencyCharIndex }; }; From c764c3590ba94ae4bdd5967211b60613ce8a549f Mon Sep 17 00:00:00 2001 From: akshayantony55 Date: Mon, 30 Oct 2023 01:08:02 +0530 Subject: [PATCH 2/3] fix #5185, InputNumber: Minus Sign not working for Currency INR --- components/lib/inputnumber/InputNumber.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/lib/inputnumber/InputNumber.js b/components/lib/inputnumber/InputNumber.js index 199e8e1bbf..ce21223be3 100644 --- a/components/lib/inputnumber/InputNumber.js +++ b/components/lib/inputnumber/InputNumber.js @@ -570,9 +570,11 @@ export const InputNumber = React.memo( _suffix.current.lastIndex = 0; let currencyCharIndex = val.search(_currency.current); - if(currencyCharIndex === 0 && _currency.current.toString() === '/[INR]/g'){ - currencyCharIndex = 3 + if (currencyCharIndex === 0 && _currency.current.toString() === '/[INR]/g') { + currencyCharIndex = 3; } + + _currency.current.lastIndex = 0; return { decimalCharIndex, minusCharIndex, suffixCharIndex, currencyCharIndex }; }; From 35ca0d7bebce39b11ab9a5be4fce8cb2551c1f67 Mon Sep 17 00:00:00 2001 From: akshayantony55 Date: Mon, 30 Oct 2023 01:10:53 +0530 Subject: [PATCH 3/3] fix #5185, InputNumber: Minus Sign not working for Currency INR --- components/lib/inputnumber/InputNumber.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/lib/inputnumber/InputNumber.js b/components/lib/inputnumber/InputNumber.js index ce21223be3..c8d82d723d 100644 --- a/components/lib/inputnumber/InputNumber.js +++ b/components/lib/inputnumber/InputNumber.js @@ -573,7 +573,7 @@ export const InputNumber = React.memo( if (currencyCharIndex === 0 && _currency.current.toString() === '/[INR]/g') { currencyCharIndex = 3; } - + _currency.current.lastIndex = 0; return { decimalCharIndex, minusCharIndex, suffixCharIndex, currencyCharIndex };