Reputation: 211
I want to set 10 years back date from today date in kendo datepicker.
Upvotes: 1
Views: 1271
Reputation: 124
For an example: When we are working with any Bank form applications, the applicant should have minimum 20 years from Today's Date to apply a particular Exam.
So It's Better to give Max-Date as the Day 20 years from Today's Date It is very easy to set past 'n' number of years date from today date in kendo datepicker.
Find the small snippet below.
var toDate = new Date();
// Here 'n' Excludes number of years from today's Date.
var pastDate= new Date(toDate.setFullYear(toDate.getFullYear()- n));
$("#birthDayDate").kendoDatePicker({ max: pastDate });
Upvotes: 1
Reputation: 1086
If you want to initialize your date picker with 10 years back date always, then in your HTML it would be something like this:
@(Html.Kendo().DatePicker().Name("myDatePicker").Value(DateTime.Today.AddYears(-10)))
Upvotes: 2