After updating to 2015.2 I am getting the error "Uncaught Error: MinValue option can not be set runtime." when trying to set a minValue for an igDatePicker that I have.
My app allows the user to select a date range, such as the previous 3 months or previous 6 months. When that change was made I was adjusting the minimum and maximum dates as needed via something like "igDatePicker("option", "minValue", StartDate);" This would prevent the user ever being able to select a date outside of the ranges I set. Meaning, they were unavailable to the user in the datepicker itself.
Now with 2015.2, I am getting this error and the dates are still available.
How can I set these dates at run-time now?
Lastly, why would something like this change? It's quite ridiculous and extremely frustrating.
After a bit more testing, minDate and maxDate can be set. However, the drop down calendar does not respect these values. I can still pick dates outside of the minimum or maximum dates I have set.
Hi Cecil,
If you want to have the min and max dates disabled on the calendar when it gets opened, you need to pass minDate and maxDate as datepikcerOpitions of the igDatePicker. We are using the jQueryUI datepicker calendar and that's why we have such an option to configure the calendar settings.
Let me know if this works for you, or you need further assistance.
Thanks,
Based on the API documentation I expected I would be able to set these values like:
$(".selector").igDatePicker("option", "datepickerOptions", { minDate: StartDate });
$(
".selector"
)
However, these does not seem to work for me.
To get the proper response I am using:
$(".selector").datepicker("option", "minDate", StartDate);
Is this correct?
The datepickerOptions property is not designed to be changed at runtime, because internally we are using some of the options and allowing the user to change them using our API might break our own functionality. The calendar is instantiated only once that why the first setting is not working. We need to add warning in case set options is used.
To be sure you get the correct instance it's best to use getCalendar method.
$(".selector").igDatePicker("getCalendar").datepicker("option", "minDate", StartDate):
Hope that helps.
Unfortunately it does not. My application requires that the min and max dates to be changed at runtime.
Sorry for the late response, but I wanted to investigate the use case. There is an issue in widget method of jQueryUI which returns the calendar html, but not the widget.
We've decided to implement safely update of datepickerOptions at runtime. And the fix will be available into the next SR and next Biweekly. When you get the update you'll be able to set the value runtime -> $("#calendar").igDatePicker('option', 'datepickerOptions' ,{ 'minDate' : new Date(2015, 10, 10) });
Keep in mind the setting only updates the value but is not deleting the existing ones.
If you need urgent solution you can use the following code: $("#calendar").igDatePicker('field').datepicker( "option", "minDate", new Date(2015, 10, 15) )
Hope that helps
That suggestion works as does this:
$("#calendar").datepicker("option", "minDate",new Date(2015, 10, 15) );
Your suggestion will work only when you use as a source element input - if you try to instantiate on div, or span it won't work. That's why it's preferable to work with the API.
Thanks for pointing the missing setOption.