My problem is that I'm not able to get the date with a month number format.

This is my code:

    <ui:inputDate aura:id="input" 
        required="true" />

As we can see, the input is disabled by default, so if we enable the inputDate again we'll see that the month is showing as string and not as a number, here is an example:

enter image description here

How could I force the ui component to show month as a number? Am I doing something wrong?


I've made up a quick solution, but I think it should be a better solution. This is my code:

    <aura:if isTrue="{!(!v.disabled)}">
        <ui:inputDate aura:id="input" 
            required="{!v.required}" />
    <aura:set attribute="else">
        <ui:inputDate aura:id="input" displayDatePicker="true" disabled="{!v.disabled}"/>

This causes the disabled input to be destroyed, when the disabled status change, and a new one is rendered without being disabled by default and, thus, with the desired format.

| 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.