Kendo MVC DatePicker issue for traditional chinese in Kendo Grid

153 Views Asked by At

I have a kendo grid and in that one column is Date. In that column Kendo datepicker is not working correctly for traditional chinese. It is swapping the date and month , so if I give date more than 12 then it is getting reset and sending 1/1/1 to the controller. It is working fine for Simplifies chinese and English cultures.

I tried using other possible date formats and data annotations but it is not working .

@(Html.Kendo().Grid<BouquetModel>()
        .Name("SGrid")
        .Columns(columns =>
        {
            columns.Command(command =>
            {
                command.Edit();
                
                command.Destroy().Text(" ").HtmlAttributes(new { id = "action_delete"});
                command.Custom("Activate")
                    .Text(" ")
                    .Click("kGridActivateItem")
                    .HtmlAttributes(new { id = "action_activate"});
                command.Custom("Deactivate")
                    .Text(" ")
                    .Click("kGridDeactivateItem")
                    .HtmlAttributes(new { id = "action_deactivate" });
            }).Width(150);
            columns.Bound(c => c.Version).Width(70);
**            columns.Bound(c => c.IssueDate).Width(80).Format("{0:MM/dd/yyyy}");
**```

columns.Bound(c => c.IssueDate).Width(80).Format("{0:MM/dd/yyyy}"); - This column

and 
In Model
[DataType(DataType.Date)]
 public DateTime IssueDate { get; set; }

1

There are 1 best solutions below

0
Kermode On

You may have to set the culture for this page.

To see what culture is currently set you can use:

<script>
    var culture = kendo.culture();
    console.log(culture.name);
</script>

If the output is zh-TW then it's correct, that is the one for traditional chinese, but if not than you need to set it before the grid is initialized.

So before your grid you should have:

<script>
    kendo.culture("zh-TW");
</script>