Skip to content

Missing currency sign: SGD #273

Closed
Closed

Description

Singapore dollar (SGD) does not resolve to its sign: $.
https://en.wikipedia.org/wiki/Singapore_dollar

Not sure where to direct that issue. Here or formatjs?

Activity

  1. ericf commented on Jan 5, 2016

    @ericf
    Collaborator

    Which browser?

  2. ericf commented on Jan 5, 2016

    @ericf
    Collaborator

    This is a Chrome bug, try this in Firefox and you'll see it's correct:

    new Intl.NumberFormat('en-SG', {style: 'currency', currency: 'SGD'}).format(1);

    Chrome has a similar issue with INR: #231

  3. SavageWilliam commented on Jan 12, 2019

    @SavageWilliam

    @ericf

    var nf = Intl.NumberFormat(['en-sg'], {style:'currency', currency:'SGD', currencyDisplay:'symbol'});
    

    What setup is required to achieve the above with react-intl FormattedNumber?
    Must I load sg localeData?

    <FormattedNumber
        value={value}
        style='currency'
        minimumFractionDigits={0}
        maximumFractionDigits={0}
        currency={'SGD'} />
    
  4. arvinsim commented on Apr 16, 2021

    @arvinsim

    I have the same issue. I still get SGD instead of S$

  5. orkunozekin commented on Jun 8, 2022

    @orkunozekin

    A way around can be by manually inserting the SGD symbol as an exception to other currencies:

    `const formatCost = (cost, currency = "USD") => {
    let formatter = new Intl.NumberFormat('en-US', {
    style: 'currency',
    currency: currency,
    })
    //because Intl.NumberFormat doesn't support SGD
    if (currency === 'SGD') {
    formatter = new Intl.NumberFormat('en-US', {
    style: 'decimal',
    })
    return 'S$' + formatter.format(Number(cost))
    }

    return formatter.format(Number(cost))
    }`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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