I started having issues with date pickers today.
This works fine. However, when I select today's date and I do:
d is set to null (or undefined depending on the browser).
Is this a bug? How do I make it work correctly?
10 Answers, 1 is accepted
The issue you are experiencing is caused by the fact that the variable today = new Date() contains information not only about the current date, but also the current time. The datePicker the compares date objects and as a result the date selected by mouse click is not greater or equal to the min value.
Nevertheless this behaviour is not intuitive, so we will address it as a problem and it will be fixed as soon as possible. As a small sign of our appreciation for your feedback I updated your Telerik points.
Meanwhile, as a workaround you can set the min/max values in the following way:
For convenience I made a small example that uses this approach in action. I hope this helps.
the Telerik team
It's almost 2018, issue still persists.
Couldn't edit my post after accidentally posting it.
Both values return null when using .value();
Was this issue ever fixed?
Thank you for providing the code.
After using it to make two datePickers, and selecting the corresponding max dates, the value method is returning the current date on my end.
Please check the example and advise if I missed an important detail:
I used the same code in an MVC project and it works as expected on my side. The code is:
I hope the above could help as a reference.
In dojo sample, min Date but still return null :
elmFromDate.min(new Date(1, 0, 1, 0, 0, 0));
I added the code to the Dojo, and it seems the value is displayed okay:
Could you please elaborate on what am I missing?
No, Your should not input "1/1/1901", it is the default min date of DatePicker/DateTimePicker.
min(new Date(1, 0, 1, 0, 0, 0)) means 1/1/0001 (day/month/year),
but if you input "1/1/1" will return null even if min() previous set.
In order to create and get dates between the years 0 and 99 the Date.prototype.setFullYear() and Date.prototype.getFullYear() methods should be used. This is also demonstrated in the above article.
For example, check this Dojo: