bug with Date template for years beyond 2099?

4 posts, 0 answers
  1. Samuel
    Samuel avatar
    19 posts
    Member since:
    Aug 2012

    Posted 18 Jan 2013 Link to this post

    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?
  2. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2172 posts

    Posted 22 Jan 2013 Link to this post

    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!
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Samuel
    Samuel avatar
    19 posts
    Member since:
    Aug 2012

    Posted 22 Jan 2013 Link to this post

    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!
  5. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2172 posts

    Posted 23 Jan 2013 Link to this post

    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!
Back to Top
UI for ASP.NET MVC is VS 2017 Ready