3

I have used lightning-formatted-number like below in one of my LWC

<lightning-formatted-number class="slds-text-align_left" value={someVariable} format-style="currency"></lightning-formatted-number>

In org Company Information setup, I have set Currency Locale to CAD.

For some users this is working fine and I can see CA$ prefix for the currency. While for some other users (users which were already present before the Currency Locale change) its not working as expected, I can see $ instead of CA$.

For debugging I tried hardcoding attribute currency-code="CAD" and still the CA$ was not populated for these users.

1
  • does your org have multi-currency enabled? Commented Jan 12, 2023 at 2:54

1 Answer 1

0

I didn't find how to remove CA before $.

Instead, I use the following code:

<!-- YourComponent.html -->
<template>
    {formattedCurrency}
</template>

// YourComponent.js
import { LightningElement, api } from 'lwc';

export default class YourComponent extends LightningElement {
    @api someVariable;

    get formattedCurrency() {            
        const formattedValue = new Intl.NumberFormat('en-US', {
            style: 'currency',
            currency: 'USD',
            maximumFractionDigits: 2,
        }).format(someVariable);
        return formattedValue;
    }
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .