1

Is there a way to use lightning:input with formatter="currency" to show whole number instead of Decimal number

<lightning:input aura:id="{!item.Id + 'CY_Tile_Budget__c' }" 
   type="number" name="CY_Budget__c" 
   label="CY Budget " value="{!item.CY_Budget__c}"  
   formatter="currency"  step="1" min="0" />

For example if item.CY_Budget__c is 10 I want it to display $10 instead of $10.00?

Is that possible?

  • 5
    in my experience, if you use formatter="currency" - you cannot remove the decimals in your number – Itai Shmida Nov 29 '17 at 8:05
  • 1
    Yeah that's kind of what I thought. Thanks for the reply though. – Jay Bolt Nov 30 '17 at 13:18
0

It looks like you already have the solution, I was able to accomplish this using the step attribute and setting it equal to 1.

<lightning:input label="Input" type="number" formatter="currency" variant="label-hidden" value="{!v.value}" step="1"></lightning:input>

This is working on API Version 43.0

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.