Skip to content

Strange behavior when the precision value of the statistics component is negative #35450

@ty888

Description

@ty888

Reproduction link

Edit on CodeSandbox

Steps to reproduce

Just follow the sample code found here: sample

What is expected?

input: <Statistic title="Active Users" precision={-1} value={-1112893.1212} />
output: -1,112,893.1212 or -1,112,893

input: <Statistic title="Active Users" precision={-2} value={-1112893.1212} />
output: -1,112,893.1212 or -1,112,893

input: <Statistic title="Active Users" precision={-3} value={-1112893.1212} />
output: -1,112,893.1212 or -1,112,893

What is actually happening?

input: <Statistic title="Active Users" precision={-1} value={-1112893.1212} />
output: -1,112,893.121

input: <Statistic title="Active Users" precision={-2} value={-1112893.1212} />
output: -1,112,893.12

input: <Statistic title="Active Users" precision={-3} value={-1112893.1212} />
output: -1,112,893.1

Environment Info
antd 4.20.3
React 16.11
System mac
Browser Google Chrome

When this accuracy value is negative, it does not work properly, so it needs to be limited.
Can I try to fix it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedThe suggestion or request has been accepted, we need you to help us by sending a pull request.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions