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

DatePicker throws wrong validation

1 Answer 385 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
Tuan Minh
Top achievements
Rank 1
Tuan Minh asked on 10 Nov 2016, 09:16 AM

Hi Kendo Team,

I have a MVC DatePicker as so: 

@(Html.Kendo().DatePicker()
  .Name("FromDate")
  .HtmlAttributes(new { style = "width: 150px" })
  .Min(new DateTime(2013, 01, 01))
  .Value(DateTime.Today.Date)
  .Format("dd MMM yyyy")
  .HtmlAttributes(new { @class = "form-control" })
)

However, whenever I selected a value, it always throws error message "The field ToDate must be a date." This only occurs after I have migrated my solution to Kendo 2016.3.1028. At first I thought it was due to culture info but kendo culture is set to "en-SG" which should take the format "dd MMM yyyy".

Thank you,

Minh Pham.

1 Answer, 1 is accepted

Sort by
0
Accepted
Boyan Dimitrov
Telerik team
answered on 14 Nov 2016, 06:50 AM

Hello Tuan Minh,

The datepicker does not have its own validation. Which validator are you using? The Kendo Validator or the jQuery validation? If you are using the Kendo Validator then you should either use a Kendo culture that contains the format used for the datepicker or the approach demonstrated here. If you are using the jQuery validation then you should override the validator date method as demonstrated here.

Regards,
Boyan Dimitrov
Telerik by Progress
 
Build rich, delightful, *native* Angular 2 apps with Kendo UI for Angular 2. Try it out today! Kendo UI for Angular 2 (currently in beta) is a jQuery-free toolset, written in TypeScript, designed from the ground up to offer true, native Angular 2 components.
 
Tags
Date/Time Pickers
Asked by
Tuan Minh
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Share this question
or