Salesforce Asked by Krishna Casukhela on October 4, 2021
I have as follows:
<aura:attribute name="todayDate" type="Date"/>
<lightning:input type="dateTime" aura:id="dat" label="Follow Up" min="{!v.todayDate}"/>
In the doInit event of the component I have as follows
component.set("v.todayDate",new Date());
But when the component loads user is able to select past dates also. Pls let me know where I am going wrong.
in your doInit function you have to set today date by using localization service for todayDate
attribute.
like below cmp
<aura:attribute name="todayDate" type="DateTime"/>
controller.js
var timezone = $A.get("$Locale.timezone");
var datetimestring = new Date().toLocaleString("en-US", {timeZone: timezone}),
datetime = new Date(datetimestring);
datetime.setHours(datetime.getHours()+1);
component.set('v.todayDate', datetime);
above solution works for me until summer20
, after seen your comment i checked my project components all of them are broke. after all analysis what i found in summer20
release notes again. there is changes for lightning:input type=Date/datetime
The input types date and datetime have changed.
1.On the current month view of the date picker, you can now select a date from the previous and next month. Previously, dates from the previous and next month were disabled on the current month view unless you navigated directly to those months.
2.When you specify min and max values, users can still select a date outside of the min and max range. However, the blur event triggers the field to display a validation error message.
3.The names for months and weekdays in the date picker now use your Salesforce language setting. Previously, these names used your locale setting.
so in your case 2 point applied. that's why past dates are not disable. instead it giving the error.
Answered by sdandamud1 on October 4, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP