diff --git a/src/data/helper/dataValueHelper.ts b/src/data/helper/dataValueHelper.ts index 89148d0f5b..18764920fa 100644 --- a/src/data/helper/dataValueHelper.ts +++ b/src/data/helper/dataValueHelper.ts @@ -67,7 +67,7 @@ export function parseDataValue( ? NaN // If string (like '-'), using '+' parse to NaN // If object, also parse to NaN - : +value; + : Number(value); }; diff --git a/src/data/helper/sourceHelper.ts b/src/data/helper/sourceHelper.ts index d1aa89d5ef..a4c47721a9 100644 --- a/src/data/helper/sourceHelper.ts +++ b/src/data/helper/sourceHelper.ts @@ -449,8 +449,8 @@ function doGuessOrdinal( function detectValue(val: OptionDataValue): BeOrdinalValue { const beStr = isString(val); // Consider usage convenience, '1', '2' will be treated as "number". - // `isFinit('')` get `true`. - if (val != null && isFinite(val as number) && val !== '') { + // `Number('')` (or any whitespace) is `0`. + if (val != null && Number.isFinite(Number(val)) && val !== '') { return beStr ? BE_ORDINAL.Might : BE_ORDINAL.Not; } else if (beStr && val !== '-') {