Skip to main content

I have a requirement wherein the user enters a data and if the date is more than 30 days then I show a validation error msg in lightning component. Below is the code I have done <aura:attribute name="todayDate" type="date" description="date" default=""/> <lightning:input type="date" aura:id="IssuedDate" name="IssuedDate" label="Issued Date to" max="{!v.todayDate}" messageWhenRangeOverflow="Service To Date cannot be greater than 30 days the current date" In

<aura:attribute name="todayDate" type="date" description="date" default="" />
<lightning:input type="date" aura:id="IssuedDate" 
name="IssuedDate" label="Issued Date to" max="{!v.todayDate}" 
messageWhenRangeOverflow="Service To Date cannot be greater than 30 days the current date" />

In the Load event of lightning component I am doing as follows var todayDate = $A.localizationService.formatDate(new Date(), "YYYY-MM-DD"); component.set("v.todayDate",d.setMonth(1)); But:

var todayDate = $A.localizationService.formatDate(new Date(), "YYYY-MM-DD"); 
component.set("v.todayDate",d.setMonth(1));

But its not working as expected. Please let me know.

I have a requirement wherein the user enters a data and if the date is more than 30 days then I show a validation error msg in lightning component. Below is the code I have done <aura:attribute name="todayDate" type="date" description="date" default=""/> <lightning:input type="date" aura:id="IssuedDate" name="IssuedDate" label="Issued Date to" max="{!v.todayDate}" messageWhenRangeOverflow="Service To Date cannot be greater than 30 days the current date" In the Load event of lightning component I am doing as follows var todayDate = $A.localizationService.formatDate(new Date(), "YYYY-MM-DD"); component.set("v.todayDate",d.setMonth(1)); But its not working as expected. Please let me know.

I have a requirement wherein the user enters a data and if the date is more than 30 days then I show a validation error msg in lightning component. Below is the code I have done

<aura:attribute name="todayDate" type="date" description="date" default="" />
<lightning:input type="date" aura:id="IssuedDate" 
name="IssuedDate" label="Issued Date to" max="{!v.todayDate}" 
messageWhenRangeOverflow="Service To Date cannot be greater than 30 days the current date" />

In the Load event of lightning component I am doing as follows:

var todayDate = $A.localizationService.formatDate(new Date(), "YYYY-MM-DD"); 
component.set("v.todayDate",d.setMonth(1));

But its not working as expected. Please let me know.

added 80 characters in body
Source Link

I have a requirement wherein the user enters a data and if the date is more than 30 days then I show a validation error msg in lightning component. Below is the code I have done <aura:attribute name="todayDate" type="date" description="date" default=""/> <lightning:input type="date" aura:id="IssuedDate" name="IssuedDate" label="Issued Date to" max="{!v.todayDate}" messageWhenRangeOverflow="Service To Date cannot be greater than 30 days the current date" In the Load event of lightning component I am doing as follows var todayDate = $A.localizationService.formatDate(new Date(), "YYYY-MM-DD"); component.set("v.todayDate",d.setMonth(1)); But its not working as expected. Please let me know.

I have a requirement wherein the user enters a data and if the date is more than 30 days then I show a validation error msg in lightning component. Below is the code I have done <lightning:input type="date" aura:id="IssuedDate" name="IssuedDate" label="Issued Date to" max="{!v.todayDate}" messageWhenRangeOverflow="Service To Date cannot be greater than 30 days the current date" In the Load event of lightning component I am doing as follows var todayDate = $A.localizationService.formatDate(new Date(), "YYYY-MM-DD"); component.set("v.todayDate",d.setMonth(1)); But its not working as expected. Please let me know.

I have a requirement wherein the user enters a data and if the date is more than 30 days then I show a validation error msg in lightning component. Below is the code I have done <aura:attribute name="todayDate" type="date" description="date" default=""/> <lightning:input type="date" aura:id="IssuedDate" name="IssuedDate" label="Issued Date to" max="{!v.todayDate}" messageWhenRangeOverflow="Service To Date cannot be greater than 30 days the current date" In the Load event of lightning component I am doing as follows var todayDate = $A.localizationService.formatDate(new Date(), "YYYY-MM-DD"); component.set("v.todayDate",d.setMonth(1)); But its not working as expected. Please let me know.

Source Link

show validation error msg if the user enters a data more than 1 month from the current date

I have a requirement wherein the user enters a data and if the date is more than 30 days then I show a validation error msg in lightning component. Below is the code I have done <lightning:input type="date" aura:id="IssuedDate" name="IssuedDate" label="Issued Date to" max="{!v.todayDate}" messageWhenRangeOverflow="Service To Date cannot be greater than 30 days the current date" In the Load event of lightning component I am doing as follows var todayDate = $A.localizationService.formatDate(new Date(), "YYYY-MM-DD"); component.set("v.todayDate",d.setMonth(1)); But its not working as expected. Please let me know.