Closed vishnu-vv closed 6 years ago
$rootScope.selectedRange = {
selectedTemplate:'L30D',
selectedTemplateName: 'Last 30 Days',
dateStart: new Date(tempDate),
dateEnd: new Date(),
showTemplate: true,
fullscreen: true,
firstDayOfWeek: 0,
isDisabledDate: $rootScope.isFutureDate($date)
};
$rootScope.isFutureDate = function ($date) {
return $date.getTime() < new Date().getTime();
};
@ipiz But it is causing error
$date is not defined
Thanks for your quick response
Sorry this should be the right one, just pass the reference to the function not the function call
$rootScope.isFutureDate = function ($date) {
return $date.getTime() < new Date().getTime();
};
$rootScope.selectedRange = {
selectedTemplate:'L30D',
selectedTemplateName: 'Last 30 Days',
dateStart: new Date(tempDate),
dateEnd: new Date(),
showTemplate: true,
fullscreen: true,
firstDayOfWeek: 0,
isDisabledDate: $rootScope.isFutureDate,
};
@ipiz Let me try that, Thanks a lot yaar. 👍
@ipiz Actually, what is this property isDisabledDate
meant for, i thought it was meant for disabling the future dates in the date-range-picker.
But trying the options you gave me, the future dates are not disabled.
@ipiz Any update ?
It disable dates when your callback returns true you can check some example at the demo site https://ipiz.herokuapp.com/md-date-range-picker-demo/index.html
$rootScope.isFutureDate = function ($date) {
return $date.getTime() < new Date().getTime();
};
$rootScope.selectedRange = {
selectedTemplate:'L30D',
selectedTemplateName: 'Last 30 Days',
dateStart: new Date(tempDate),
dateEnd: new Date(),
showTemplate: true,
fullscreen: true,
firstDayOfWeek: 0,
isDisabledDate: $rootScope.isFutureDate,
};
This did the fix for me. Thanks brother. 👍
PS: define the function $rootScope.isFutureDate
before $rootScope.selectedRange
Like this