Skip to content

Fix AmountInput default value (fix #1267)

Nicolas Frandeboeuf requested to merge nicofrand/changing-the-sign-of-1267 into main

The default value could be -50. We then create two properties from it: value (which equals -50) and isNegative (which is true).

Later, when toggling the sign we set isNegative to false and compute a value based on those two properties: if isNegative is true, we return -value (--50 -> 50), else value, so we return value which still equals -50.

The value displayed was always correct because we applied Math.abs to it.

Edited by Nicolas Frandeboeuf

Merge request reports

Loading