This is a migrated thread and some comments may be shown as answers.

DatePicker - Range Selection Demo doesn't work?

4 Answers 450 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
Steve
Top achievements
Rank 1
Steve asked on 09 Dec 2011, 07:22 PM
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.
-Steve

4 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 12 Dec 2011, 06:04 PM
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.

Regards,
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!
0
Cody
Top achievements
Rank 1
answered on 01 Oct 2013, 09:21 PM
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.
0
Georgi Krustev
Telerik team
answered on 04 Oct 2013, 08:14 AM
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.

Regards,
Georgi Krustev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Atlas
Top achievements
Rank 1
answered on 08 Nov 2014, 12:44 AM
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:

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

Tags
Date/Time Pickers
Asked by
Steve
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Cody
Top achievements
Rank 1
Atlas
Top achievements
Rank 1
Share this question
or