0

This question already has an answer here:

I'm using lightning input of type date in my lighting component. Once the date is selected it is showing date as **Feb 12, 2019 ** But we want the date to be shown as MM/DD/YY. is it possible

Here is the code:

<div class="slds-form-element">
                                <div class="slds-form-element__control">
                                    <lightning:input type="date" aura:id="fieldId" label="Start Date of Travel"
                                                     name="startDateOfTravel"
                                                     value="{!v.startDateOfTravel}"
                                                     required="true"/>
                                </div>
                            </div>

een

marked as duplicate by Raul, Derek F, glls, battery.cord, Pranay Jaiswal Feb 11 at 15:18

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    Could you edit your question and add some code to illustrate the problm? – Raul Feb 11 at 12:59
  • Added code and screenshot for clarity – prasanthcheenu Feb 11 at 13:04
1

You can use ui:inputDate, you can define your date format in format attribute.

<ui:inputDate aura:id="EndDateField" value="" displayDatePicker="true" format="MM/dd/yyyy"/>
  • on validating these using aura:id the program is not responding. could there be any reason. – prasanthcheenu Feb 11 at 14:03
  • What kind of validation are you doing ? – MIX DML Feb 12 at 6:52
  • var allValid = component.find('expdate').reduce(function (validFields, inputCmp) { – prasanthcheenu Feb 12 at 12:10
  • I'm getting this error – prasanthcheenu Feb 12 at 12:10
  • This page has an error. You might just need to refresh it. Action failed: c:DateValidation$controller$doAction [inputCmp.showHelpMessageIfInvalid is not a function] Failing descriptor: {c:DateValidation$controller$doAction} – prasanthcheenu Feb 12 at 12:10

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