We are experiencing an issue with the Kendo ui datetime picker in our MVC Sitefinity application. The issue manifests itself only in IE after a workaround JavaScript function has been applied. The application's default culture is set to fr-CA however in the view the date format needs to be fr-FR. If submit is clicked and the text area of the datetime picker is empty the validation message as set on the model property is displayed correctly, however if any non valid text is entered into the text area then the validation message displayed is: "DateDebut is not a valid date". The workaround function replaces the data-val-date attribute displaying the correct validation message in the French language and as stated works in all browsers but IE. As show below the kendo culture is set to fr-FR.
$(document).ready(function () {
kendo.culture("fr-FR");
});
$(function () {
$("input[data-val-date]").each(function (index, el) {
var re = new RegExp("The field (.*?) must be a date");
var string = $(this).attr("data-val-date");
var m = string.match(re);
if (m != null && m.length > 1) {
$(this).attr("data-val-date", string.replace(m[0], "Le champ " + m[1] + " doit être une date (ex: 14/06/2015)"));
}
});
});
<
div
class
=
"form-group"
style
=
"width: 100%"
>
@Html.LabelFor(m=> m.DateDebut, new { @class = "control-label col-sm-4" })
<
div
class
=
"col-sm-3"
>
@Html.Kendo().DatePickerFor(m => m.DateDebut).Format("{0:dd/MM/yyyy}").HtmlAttributes(new {@style="width:150px;"})
@Html.ValidationMessageFor(m => m.DateDebut)
</
div
>
</
div
>