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

Entering date manually in a date filter in the grid

4 Answers 171 Views
Grid
This is a migrated thread and some comments may be shown as answers.
BishMan
Top achievements
Rank 1
BishMan asked on 18 Jun 2013, 03:20 PM
Hello all,

I have a grid with a date filter, if I pick the date from the date picker included in the filter it all works fine.

If I enter the date as 06/17/2013 that works fine, but on the other hand if I enter the date 06/17/13 (2 digit year) I do not get results back.

What can I do to over come this issues. 

4 Answers, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 20 Jun 2013, 09:54 AM
Hello Jay,

Basically the DateTime picker widget will accept two digit years if the format of the year is set to be 'yy'. To change this default format you can use the filterMenuInit event of the Grid to find these datepicker widgets and change their format.

e.g.

function onFilterInit(e){
    e.container.find('[data-role=datepicker]').each(function(){
         $(this).data().kendoDatePicker.options.format = 'M/d/yy'
    })
}


Regards,
Petur Subev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
BishMan
Top achievements
Rank 1
answered on 20 Jun 2013, 01:40 PM
Thank for your reply but based on that the user can only enter 2 digit year, I would like to support both cases where they enter either 4 digits or 2 digit year.

Is that possible?  If it is how do I do that.
0
Petur Subev
Telerik team
answered on 24 Jun 2013, 07:45 AM
Hello Jay,

The format can only be one at a time it is used for displaying and parsing:

http://docs.kendoui.com/api/web/datepicker#configuration-format


I am afraid there is not work-around to this.

Kind Regards,
Petur Subev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Bradley Fulton
Top achievements
Rank 1
answered on 23 Sep 2015, 12:14 AM

I seem to be able to enter either two- or four-digit years.  However, I set the parseFormat to ["M/d/yy"] and format to "M/d/yyyy" but my computer's regional date is set to "M/d/yyyy".  The "d" format for dates in kendo.culture.en-us.js is "M/d/yyyy".  If you want much more detail, see

 http://bradfultonprogramming.blogspot.ca/2014/04/a-non-standard-date-format-with-aspnet.html

Tags
Grid
Asked by
BishMan
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
BishMan
Top achievements
Rank 1
Bradley Fulton
Top achievements
Rank 1
Share this question
or