DatePicker - Range Selection Demo doesn't work?

5 posts, 0 answers
  1. Steve
    Steve avatar
    1 posts
    Member since:
    Nov 2010

    Posted 09 Dec 2011 Link to this post

    Unless I misunderstand the purpose of the datepicker range selection demo, it appears it does not work as expected.

    I select a start date of say 1 month from today. Then I go into the end date and I am able to select a date earlier than the start date.

    Can someone confirm this as a bug or just my misunderstanding of the purpose of that demo?

    Also I noticed the date picker doesn't appear to care if I enter bogus date values in the input box like 14/01/2011 which is not valid for MM/DD/YYYY format since 14 is not a valid month.

    Thanks for your feedback. I am excited about kendoUI but hesitant that there are a lot of potential bugs remaining.
  2. Georgi Krustev
    Georgi Krustev avatar
    3725 posts

    Posted 12 Dec 2011 Link to this post

    Hello Steve,

    The DatePicker UI widget does not prevent posting an incorrect date. The min/max range restricts the calendar and end-user cannot select a date, which is out of range. It is allowed to type an invalid date, but the DatePicker's value will be null. You can observe this behavior on this online demo. 
    In order to prevent posting an incorrect value you should use client-side validation.

    As a side note, there was a bug related with the "today" link in the calendar. In the demo you can select today's date, even it is not allowed. This issue is already addressed and the fix will be available in the next release of KendoUI.

    Georgi Krustev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Cody
    Cody avatar
    12 posts
    Member since:
    May 2013

    Posted 01 Oct 2013 Link to this post

    I know this is old but I don't get the point of the range selection demo. It doesn't work as I was expecting and have no idea what the point of the demo is if it is not to illustrate how you can control the limits of the date picker using the max and min.  I believe Georgi's response suggests that the datepicker is supposed to prevent the user from selecting a date that is not in range but that is not occurring in the demo.

    Looks broken to me.
  4. Georgi Krustev
    Georgi Krustev avatar
    3725 posts

    Posted 04 Oct 2013 Link to this post

    Hello Cody,

    The Range Selection demo shows how to use the min/max method to connect to DatePickers. Once the user selects date from the first widget, the second does not allow to pick date earlier then the selected one. Please note that widget does not restrict user input - if he/she decides to enter invalid date, the widget will set its value to null. If you need to restrict the input, then use Kendo Validator or other validation framework, which will notify the user that the entered value is not valid/out of range.

    Georgi Krustev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  5. Atlas
    Atlas avatar
    97 posts
    Member since:
    Jun 2009

    Posted 07 Nov 2014 in reply to Steve Link to this post

    I have been pretty disgusted with the validation on the kendo datepicker. What good is validation if it doesn't work regardless of the way the data is input. The validation works great if you use the calendar icon to pick your date, but provides no validation if you hand type in a value.
    I have been complaining about this for some time, and the solution I got from Telerik was a cluster. I was having to use a lot of extra code to make it work.
    Well I finally got around to investigating custom code attributes, both server side and client side, and discovered that it is quite easy to add a custom code attribute that works on both the client and the server side. You have to create a class that handles both scenarios, and you have to write some custom javascript, but once you get the hang of it, it's really easy.
    We have requirements on several of our date values that they are on or before today or on or after today, so I created two attributes:
    1) DateTimeMaxNowAttribute
    2) DateTimeMinNowAttribute
    I will attach the files for all of this. One of the namespaces you will need is the one that supports: ModelClientValidationRule apparently, from what I am reading this used to be in a different namespace, but I you are using MVC 4 or later, this rule exists in the System.Web.WebPages namespace.
    use the code  in the attached files and simply decorate your property like so:

            [DisplayName("Estoppel Request Date")]
            [DisplayFormat(DataFormatString = "{0:d}")]
            public DateTime? EstoppelRequestDate { get; set; }

Back to Top