function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Emma Brown 23Emma Brown 23 

change date style to short for lightning-input-field

I am using lightning-record-edit-form to creat/update existing record. I want to show date and datetime type fields in short format to align with salesforce forms.

One option that we found is with date-style for input-field but we don't want to change the component here. We wan't to do it with lightning-input-field only.

Default date-style for lightning-input-field:
User-added image
Date-style on salesforce forms: 
User-added image
I am trying to change date style to short for lightning-input-input field. but could not find any option to do so.

Any assistance would be greatly appreciated.

Thank you

 
Suraj Tripathi 47Suraj Tripathi 47

Hi Emma,

Please find the solution.

<aura:attribute name="Email" type="String"  />
      <lightning:input type="String" name="Email" label="Email" value="{!v.Email}" style="width:100px;" />
You can add style in your input.

You can take reference from the below link:

https://developer.salesforce.com/docs/component-library/bundle/lightning:input/example#lightningcomponentdemo:exampleInputDateTime

or

You can create calendar : https://www.lightningdesignsystem.com/components/datepickers/

Please mark it as the Best Answer if it helps you.

Thank You

Devashree Tidke 23Devashree Tidke 23
@Emma Did you find any solution for this issue. I am currently facing exact same issue.
Rocket Roll 4Rocket Roll 4
Same issue here