2

i have an input field like this,

<lightning:input type="date" aura:id="inputdate" label="Birthday"  name="birthday" date-style="short"/>

enter image description here

I read similar question here Lightning:input type="date": how to change the date fomat

But the attribute date-style="short" is not work for now. How i can use another attribute to format this birthday field?

1
  • why would you put the least significant number (d) in between the middle number (M) and most significant number? (YYYY) - M/d/yyyy makes no sense
    – hanshenrik
    Commented Oct 24, 2022 at 14:01

1 Answer 1

0

Instead of using lightning-input, you can use

<input type="date" value="2017-06-01" 
 />

This will work same and give you MM/DD/YYYY format.

6
  • Thank for your help, but i need use lightning-input because i want to work with controler and get data from Apex class Commented Oct 24, 2022 at 3:59
  • In normal input as well you can do whatever you do with lightning input. You can get value from apex. And you can use onchange in this field as well. I am not sure what is stopping you to use this. Commented Oct 24, 2022 at 4:11
  • because it no have slds, i don't want to write css Commented Oct 24, 2022 at 4:22
  • You can put this inside div tag and use slds classes on that div Commented Oct 24, 2022 at 4:23
  • 1
    great thank u bro Commented Oct 24, 2022 at 4:52

You must log in to answer this question.

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