DatePicker value() returns null after min() is set and min date is selected

2 posts, 1 answers
  1. Jose
    Jose avatar
    49 posts
    Member since:
    Aug 2008

    Posted 13 Jun 2012 Link to this post

    Hi guys.
    I started having issues with date pickers today.

    In Javascript I set the min date of a date picker to today and the value for tomorrow,

    var today = new Date();
    var tomorrow = new Date();
    tomorrow.setDate(today.getDate() + 1);

    This works fine. However, when I select today's date and I do:

    var d = $("#start_date").data("kendoDatePicker").value();

    d is set to null (or undefined depending on the browser).

    Is this a bug? How do I make it work correctly?

  2. Answer
    Alexander Valchev
    Alexander Valchev avatar
    2873 posts

    Posted 18 Jun 2012 Link to this post

    Hello Jose,

    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:
    var today = new Date("06/18/2012");

    For convenience I made a small example that uses this approach in action. I hope this helps.

    Kind regards,
    Alexander Valchev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top