Skip to content

Commit f314b72

Browse files
author
NarrowsProjects
committed
feat: guard against parsing empty strings to NaN in DateTimeInputModel and NumericalComparisonModel
1 parent f9dc13a commit f314b72

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

lib/public/components/Filters/common/filters/NumericalComparisonFilterModel.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,13 @@ export class NumericalComparisonFilterModel extends FilterModel {
9292
* @inheritDoc
9393
*/
9494
set normalized({ operator, limit }) {
95+
const parsedLimit = parseFloat(limit) / this._scale;
96+
97+
if (!isNaN(parsedLimit)) {
98+
this._operandInputModel.normalized = parsedLimit;
99+
}
100+
95101
this._operatorSelectionModel.normalized = operator;
96-
this._operandInputModel.normalized = parseFloat(limit) / this._scale;
97102
}
98103

99104
/**

lib/public/components/common/form/inputs/DateTimeInputModel.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ export class DateTimeInputModel extends Observable {
121121
return;
122122
}
123123

124+
if (typeof value !== 'number' || isNaN(value)) {
125+
return;
126+
}
127+
124128
this._value = value;
125129
this._raw = value !== null
126130
? formatTimestampForDateTimeInput(value, this._seconds)

0 commit comments

Comments
 (0)