Skip to content

Commit e3909c4

Browse files
sara-resara-gnucoop
authored andcommitted
fix(core/forms): set null value for calculate fields if value is equals to NaN
1 parent f7901b3 commit e3909c4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

projects/core/forms/src/utils/fields-instances/update-formula.ts

+6
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,17 @@ export function updateFormula(
4848
if (instance.visible) {
4949
if (formula != null && (!editable || (editable && instance.value == null))) {
5050
newValue = evaluateExpression(formula.formula, context);
51+
if (Number.isNaN(newValue)) {
52+
newValue = null;
53+
}
5154
changed = true;
5255
} else if (updateDefault && instance.node.defaultValue != null && instance.value == null) {
5356
changed = true;
5457
if (instance.node.defaultValue.formula != null) {
5558
newValue = evaluateExpression(instance.node.defaultValue.formula, context);
59+
if (Number.isNaN(newValue)) {
60+
newValue = null;
61+
}
5662
} else {
5763
newValue = instance.node.defaultValue;
5864
}

0 commit comments

Comments
 (0)