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

Copy Paste Value Not Validated in Date Picker and Returns Null

1 Answer 300 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
Shailendrasinh
Top achievements
Rank 1
Shailendrasinh asked on 25 Mar 2021, 11:43 AM

I have KendoDatePickers where it works fine if user clicks on the calendar control and selects the date.

 

But I also want that user can copy-paste the date format and it gets validated. Currently it is returning null for the value being copied like the attached image.

Is there any way I can validate the date?

Below is the JavaScript code I am using to get the values. 

Thanks.

var oEndDateAfter = $("#EndDateAfter").data("kendoDatePicker").value();<br>
var oEndDateBefore = $("#EndDateBefore").data("kendoDatePicker").value();

1 Answer, 1 is accepted

Sort by
0
Tsvetomir
Telerik team
answered on 30 Mar 2021, 06:24 AM

Hi Shailendrasinh,

In general, the Kendo UI DateTimePicker does not parse all date formats. It usually parses the formats that have been set for the specific culture as well as the custom format that has been set. In order to add additional formats that should be parsed, you should add the following option:

https://docs.telerik.com/kendo-ui/api/javascript/ui/datetimepicker/configuration/parseformats

Therefore, if you pass a value that has the same format as in the parseFormats array, it should get parsed correctly and the value of the widget should not be null.

Let me know if the issue persists.

 

Kind regards,
Tsvetomir
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Date/Time Pickers
Asked by
Shailendrasinh
Top achievements
Rank 1
Answers by
Tsvetomir
Telerik team
Share this question
or