This is a migrated thread and some comments may be shown as answers.

How to set maxDate in client-side

2 Answers 64 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Chris
Top achievements
Rank 1
Chris asked on 16 Dec 2010, 07:02 PM
Hi,
I have a datepicker and need to reset it and change its max and min date dynamically using javascript. But after I set the max and min date, and select a date, the maxDate always changes and cause the date validation returns error. Below is my javascript code:
fromPicker.maxDate = tEndDate;
fromPicker.minDate = tStartDate;
fromPicker.$calendar().data("tCalendar").maxDate = tEndDate;
fromPicker.$calendar().data("tCalendar").minDate = tStartDate;
fromPicker.value("");
fromPicker.focusedDate = tStartDate;

After running these codes, maxDates is OK. The calendar can correctly only enable dates inside the date range. But after I select a date, the validator returns error, and I found maxDate has changed(mostly a month later to minDate). How can I reset the datepicker and set maxDate correctly?
Thanks a lot.

2 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 22 Dec 2010, 09:22 AM
Hello Chris,

You need to use min() and max() methods to set minDate and maxDate of the datepicker. Check this online demo devoted on the same matter.
 

Kind regards,
Georgi Krustev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Chris
Top achievements
Rank 1
answered on 23 Dec 2010, 02:40 AM
Hello Georgi,
Works like a charm, thanks a lot
Tags
Date/Time Pickers
Asked by
Chris
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Chris
Top achievements
Rank 1
Share this question
or