As I explained in this other post there are some bugs on KendoUI core in the function that parses dates. KendoUI folks (thank, you!) have fixed them BUT this is not open source available and will not be until november. In the meantime fix it as I’ve explained in that post.
But related with this there is a missing functionality that is being able to parse (by default) ISO 8601 dates represented as yyyy-MM-ddTHH:mm:ss.fffZ
Default supported formats
In addition to date formats defined in your culture file, KendoUI defines some other patterns:
- ddd MMM dd yyyy HH:mm:ss
So any date with one of this formats is recognized.
But these formats do not include the one that we get with Date.getISOString and used for sorting date alphabetically.
So, you have to use (being str the string that contains the date being parsed):
In order to correctly parse an ISO date.
Adding yyyy-MM-ddTHH:mm:ss.fffZ format
I would like to be able to add formats to culture files and get them automatically recognized by KendoUI parsing date function but KendoUI did prefer to add only formats in culture that have the following codes:
formatsSequence = ["G", "g", "d", "F", "D", "y", "m", "T", "t"];
Likely because they want to control the precedence of the patterns.
Despite I don’t like to change to code that is open source but without a public mechanism for contributions (because each time who is controlling the code releases a new version you have to do it again) I do it when something is very located and hence easy to do it back
So, the only way is going to the source code and add the format. Edit kendo.web.js or (kendo.core.js) file and look for a function called parseDate.
formats[idx] = "ddd MMM dd yyyy HH:mm:ss";<br /> formats[++idx] = "yyyy-MM-ddTHH:mm:ss.fffZ"; formats[++idx] = "yyyy-MM-ddTHH:mm:ss.fffzzz"; formats[++idx] = "yyyy-MM-ddTHH:mm:sszzz"; formats[++idx] = "yyyy-MM-ddTHH:mmzzz"; formats[++idx] = "yyyy-MM-ddTHH:mmzz"; formats[++idx] = "yyyy-MM-dd";
formats[++idx] = "yyyy-MM-ddTHH:mm:ss.fffZ";
I do recommend adding it before yyyy-MM-ddTHH:mm:ss.fffzzz which is a very similar format but define a timezone.
Now, you can simple do:
and get the str converted to a Date.