According to Telerik's documentation, to set a RadDatePicker's mindate or maxdate properties client-side, you are to use the two methods set_minDate() and set_maxDate() respectively. I initially thought that simply passing in null into these methods would remove any constraints on the controls, but it does not seem to be the case. Does anyone have experience clearing these properties for the RadDatePicker client-side?
Thanks!
According to Telerik's documentation, to set a RadDatePicker's mindate or maxdate properties client-side, you are to use the two methods set_minDate() and set_maxDate() respectively. I initially thought that simply passing in null into these methods would remove any constraints on the controls, but it does not seem to be the case. Does anyone have experience clearing these properties for the RadDatePicker client-side?
Thanks!
Share asked Oct 30, 2009 at 19:13 Dan AppleyardDan Appleyard 7,44514 gold badges51 silver badges80 bronze badges 1- Have you tried just using a far in the past or far in the future date respectively? If you are using SQL Server datetime for example it doesn't like certain dates, like 1,000,000 AD so I'm not sure you would want that anyway, it depends on your domain. – Jarrett Widman Commented Oct 30, 2009 at 19:17
1 Answer
Reset to default 6Definitely don't pass null
to those methods, you'll get a TypeError
exception thrown ;)
When you omit MinDate
and MaxDate
from your markup, telerik internally defaults the client to new Date(1980, 0, 1)
and new Date(2099, 11, 31)
respectively. (Note: this happens in the constructor code of Telerik.Web.UI.RadDateInput
).
So the trick to "clearing" those properties is to set them back to those defaults:
$find('RadDateTimePicker').set_minDate(new Date(1980, 0, 1));
$find('RadDateTimePicker').set_maxDate(new Date(2099, 11, 31));
I know it feels wrong to do it this way, but it is the method that most closely matches what telerik does internally anyway. (Plus, telerik will ignore anything else you pass to it, eg 0
, null
, ""
, etc)