Unplanned
Last Updated: 09 Jul 2021 13:42 by ADMIN
Tyler
Created on: 08 Jul 2021 18:40
Category: KendoReact
Type: Feature Request
0
Date Picker in a form, initial values from javascript object

Hi,

 

I've got a large form I'm making. When the page the form is on first renders, I maker a server call and get back a large javascript object:

 

serverData = {id: "1", ClientID: "1423", EstSentDate: "2021-07-08", .... }. The date strings are ODCB standards for date strings.

 

The form displays the current values of all these fields. For all the other field types, I give the form the prop initialValues={serverData}, and if the field names match the object keys, it populates the field with the data nicely.

The datePicker is encountering an error though. It looks like it expects a Date object and not just a string. Is there something I can do within the DatePicker component, or the field containing it, to resolve this, without having to parse the entire data set I receive for all dates and convert them to Date objects, and feed that into a new object to pass to the form?

Being able to populate the entire form with the simple line initialValues={serverData} would be the best outcome for us.

3 comments
ADMIN
Stefan
Posted on: 09 Jul 2021 13:42

Hello, Tyler,

Thank you for the confirmation.

I converted it.

We will monitor the interest and plan it accordingly.

Regards,
Stefan
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tyler
Posted on: 09 Jul 2021 13:38
Thanks Stefan, and yeah an official request for date string handling would be great, I'm sure that's useful for others as well.
ADMIN
Stefan
Posted on: 09 Jul 2021 07:32

Hello, Tyler,

Currnetly, the DatePicker only works with Date objects. This is why in this case a parse to date is required.

I do understand that this is not ideal, and require extra steps.

If you wish, I can convert this to an official public request to support date like string for the DatePicker component. The component will try to internally parse the string to date.

Regards,
Stefan
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.