Skip to content
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
@jbedard

Description

@jbedard

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions