Question

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!

Was it helpful?

Solution

Definitely 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)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top