You need to sign in to do that
Don't have an account?
I have done the validation for my from date in lightning web components but it is not working current date
I have done the validation for my from date in lightning web components but it is not working current date.
current date also showing nvalidation if set min value as current date.so can you please help
current date also showing nvalidation if set min value as current date.so can you please help
Could you please give more clarification on your question with saome code snippet that you have tried.
Thanks!
LWC
JS
connectedCallback(){
var today = new Date();
this.currentDate=today.toISOString();
var defaultcurrent = new Date();
this.minDate= defaultcurrent.toISOString();
}
Html
<lightning-input type="date" name="fromDate" label="From Date" value={currentDate} min={minDate} ></lightning-input>
above code not working for if select current date gain means show vlaidation "Value must be Jun 10, 2021 or later."
But i selected Jun 10, 2021(today date(current date).
Can you please help here
Thanks
C.Nagarajan
Add onchange handler in the input element
Add validation logic in the js file handler function out of connectedCallback() method.
try this and share the results. Thanks.
Naveen K N