Skip to content

IsCurrency support for Intl.NumberFormat #1683

Open
@Zyles

Description

@Zyles

Describe the bug

Support https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat

I am unable to get this validator to work with Intl.NumberFormat. Am I missing some options?

Examples

const price = 41.33693
product.price = new Intl.NumberFormat('sv-SE', { style: 'currency', currency: 'SEK'}).format(price)
console.log(product.price) // Returns: SEK 41.34
console.log('Validator:', validator.isCurrency(product.price), { symbol: 'SEK', allow_space_after_symbol: true, })) // Validator: false

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions