Last Updated: 01 Oct 2021 14:40 by ADMIN
Created on: 17 Oct 2012 15:05
Category: Data Source
Type: Feature Request
Date and Time pickers should always try to parse any date format when being bound using MVVM
Currently, when binding an observable viewModel to a date/time picker control, only date formats built in to the widgets ( a minimal set) and formats specified implicitly by the ParseFormats option. 

I understand the reason for this being to prevent users from being able to type a date or time into the widgets in a format other that what is deemed appropriate for the widget, but it should behave differently when being bound from a view model.

Different platforms and web APIs serialize dates in different ways and developers should not have to always write a custom parser into the kendo datasource schema  for each datetime property of an object or have to specify the ParseFormat on the widget just so it can be bound properly to a date/time picker widget.

In the latest release (as of this posting) the parsing of Microsoft's JavaScriptSerializer date format has been added, ignoring the ParseFormats of the widgets. This is a great step in the right direction, however the W3C standard ISO 8601 date format is not being parsed while bypassing the ParseFormats of the widgets.

Also, currently, the date parser will not allow parsing of ISO 8601 date strings with more than 3 decimal places for fractions of a second. Both Microsofts DateTime.ToString("O") and Newtonsoft's Json.Net's ISO serialization of dates output 7 decimal places for fractions of a second. (I have been in contact with the kendo team about this specifically and they are going to add support, however they are not currently planning to make it bypass the parseformats unless the community votes for it here on UserVoice).

Since Kendo has specific functions used for binding widgets and elements, they should be able to easily make it so all parseformats (built-in and implicitly specified) are used when parsing dates that are set using binding to widgets expecting an actual date object and not a string (the date/time pickers).