You need to sign in to do that
Don't have an account?
balaji manikandan
How to restrict past dates from date picker in lighting input?
Im using ui:inputDate to display date filed ,
Is there any solution to disable the past dates in date picker?
Is there any solution to disable the past dates in date picker?
and for lightning look n feel use slds-input class, check below post link :
http://sfdcmonkey.com/2018/02/23/restrict-past-dates-lightning-component/
let me inform if it helps you and close your query by choosing best answer if you got your answer :)
Thanks
All Answers
i have created a sample post on it, please refer the below link :
http://sfdcmonkey.com/2017/12/26/validation-past-date-lightning-component/ (http://sfdcmonkey.com/2017/12/26/validation-past-date-lightning-component/)
however there is no standard way to disable date in date picker
Thanks,
let me inform if it helps you
I saw that post in your sfdcmonkey.com , i use refer to your site first but i want it to disable the past date not by validation.
i also came across (https://codepen.io/jamesbarnett/pen/jEOQoO) this link ,where they used Jquery to similar functionality
Do you know how to implement jquery functionality in controller?
thanks
and for lightning look n feel use slds-input class, check below post link :
http://sfdcmonkey.com/2018/02/23/restrict-past-dates-lightning-component/
let me inform if it helps you and close your query by choosing best answer if you got your answer :)
Thanks
we can even dynamically set the min attribute using a string type attribute in the component and javascript in the controller
Great suggestion Anushka!
Here is the rest of the code for those interested.
In your component call your controller:
In your Controlller do this:
we can use lightning input to restrict the past dates using "min" attribute of "lightning:input".
Below is the code.
<aura:component>
<!-- used for storing today's date -->
<aura:attribute name="todaysDate" type="Object" />
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<lightning:input type="date" min="{!v.todaysDate}"/>
</aura:component>
({
doInit: function(component, event, helper) {
// get todays date
var today = new Date();
var dd = String(today.getDate()).padStart(2, '0');
var mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
var yyyy = today.getFullYear();
today = yyyy + '-' + mm + '-' + dd;
component.set("v.todaysDate",today);
},
})