6

In my app there are many users with a German or French locale. Both have in common that they use comma as decimal separator (opposed to Apex, JS and US-citizens which use a dot .) The dot instead is used as thousand separator.

When they need to enter a decimal number into lightning:input

<lightning:input aura:id="input" value="{!v.value}" type="number" variant="label-hidden" label="Value"
                     disabled="{# v.readonly}"
                     step="{# v.type == 'currency' ? 'any'
                             : v.type == 'percent' ? '0.01' : '1'}"
                     min="{# v.type == 'currency' ? '' : '0'}"
                     max="{# v.type == 'percent' ? '100' : ''}"
                     formatter="{# v.type == 'percent' ? 'percent-fixed' : ''}" />

they experience different symptoms:

SYMPTOM 1: They cannot enter a comma at all

SYMPTOM 2: When they use a dot instead it gets displayed correctly as a comma

SYMPTOM 3: When they save this number to the database the dot basically gets ignored as German thousand seperator at the wrong position

Please see this video showing all the symptoms: https://youtu.be/rE_r1-kA6fY

Note: Maybe it is because this component is still in BETA, but as this is not documented I have to assume it will not be fixed soon.

  • can you share a code of a single cell – Itai Shmida Apr 22 '18 at 8:58
  • What code are you interested in. Lightning controller or markup and which parts are of interest? – Robert Sösemann Apr 22 '18 at 19:07
  • it seems like the problem is in the markup - so show us markup code of a single cell – Itai Shmida Apr 23 '18 at 8:36
  • Is that enough? – Robert Sösemann Apr 23 '18 at 10:04
  • Hello. Have you tried using lightning:formattedNumber? You may try assigning dynamic currencyCode values according to the user's locale. <lightning:formattedNumber value="5000" style="currency" currencyCode="USD" /> . – N.. Apr 23 '18 at 12:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.