Skip to content

Allow integer parsingΒ #93

@BrOrlandi

Description

@BrOrlandi

When handling currency values in programming it's recommended to use integer values to avoid calculations and conversion mistakes due to the floating point problem.

So I want to discuss the possibility to have a prop called something like parseAsInteger so the value will be an integer, with the decimals multiplied by their precision.

So when the user input: 12,34 the value should be 1234, if the precision is 2.
If the precision is other like 3, the value 12,345 should be parsed as 12345.

Instead of having to multiply it by 100 by my self I would like to have the value parsed as integer like this.

For instance: 2.22 * 100 == 222 evaluates to false. When I multiply 2.22 by 100, it doesn't return an integer value due to the floating point problem.

I can make a PR but I want to have some feedback on this issue first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions