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

bug with Date template for years beyond 2099?

3 Answers 464 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
Samuel
Top achievements
Rank 2
Samuel asked on 18 Jan 2013, 08:29 PM
I'm working in a grid with two fields, one for effective date and the other for retirement date with the retirement date defaulting to DateTime.MaxValue. When I edit the field (inCell mode, if that matters) on the effective date all is well and I get what I'm expecting - MM/dd/yyyy format. However, when I edit the retirement date I get the full date and time format no matter how many different places I specify the format. To test this, I changed the date manually and was able to do so up until December 31st, 2099. After that date, the field went blank. Has anybody else noticed this? Ideas for a workaround other than adding a checkbox for the max date in the template?

3 Answers, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 22 Jan 2013, 01:29 PM
Hi Samuel,


Basically the DatePicker and DateTimePicker have max dates set to 2099 year by default. You can override that by setting the max date using Max method of the DatePicker and DateTimePickers pickers in the editor templates under the Views->Shared->EditorTemplates folder in the project. Please check the example below:

DateTime.cshtml:
@model DateTime?
 
@(Html.Kendo().DateTimePickerFor(m => m).Max(DateTime.MaxValue))


Kind Regards,
Vladimir Iliev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Samuel
Top achievements
Rank 2
answered on 22 Jan 2013, 03:01 PM
Thank you! Is this behavior documented somewhere (I hope)? It would be great if that line was included in the default templates, even if it was just to highlight to developers that the behavior is by default. Changing to the suggested code worked great!
0
Vladimir Iliev
Telerik team
answered on 23 Jan 2013, 11:10 AM
Hi Samuel,

Thank you for your feedback.
 
The DatePicker and DateTimePicker default Min and Max values currently are not documented, however we will include this info with next documentation update. 


Edit: You can find the Min and Max configuration options default values documented here.

Kind Regards,
Vladimir Iliev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Date/Time Pickers
Asked by
Samuel
Top achievements
Rank 2
Answers by
Vladimir Iliev
Telerik team
Samuel
Top achievements
Rank 2
Share this question
or