Skip to content

Non-standard conversion from given value into displayed value #9

@igorsantos07

Description

@igorsantos07

If a string (or a number, when it works (#6)) is given as value with not enough decimals when a said precision is needed, some integers are turned into decimals.

Example: <CurrencyInput value="6300" precision="2"/> yields a field like [63.00] instead of [6300.00].

An easy way to avoid that when receiving numbers is as follows, but string values would require manual work:

    if (typeof value == 'number') {
      value = Number(value).toLocaleString(undefined, {
            style                : 'decimal',
            minimumFractionDigits: precision,
            maximumFractionDigits: precision
      })
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions