This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
number filter converts null to "0" #6188
Closed
Description
The doc says the 'number' filter:
Formats a number as text.
If the input is not a number an empty string is returned.
But passing many non-number values (null, "", " ", [], ...) return "0" because isNaN is broken.
I think the simple fix would be making the is-number check at the start of formatNumber() better, or if that is too risky of a change then the documentation should be updated. The jQuery isNumeric implementation might be best:
!isNaN( parseFloat(obj) ) && isFinite( obj )
Metadata
Metadata
Assignees
Labels
No labels