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

DatePicker - Date Extraction

1 Answer 58 Views
Wrappers for React
This is a migrated thread and some comments may be shown as answers.
Parag
Top achievements
Rank 1
Parag asked on 30 Jan 2019, 05:20 AM

Hi,

I want to extract Date from DateTime field and bind to DatePicker. When I try to do that, it throws error as shown in below and in attached screenshot.

<DatePicker defaultValue={new Date().toLocaleDateString()}

 

Also wanted to know, Could onchange method on datepicker control return only date but not time?

 

Regards,

Parag

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 30 Jan 2019, 07:56 AM
Hello, Parag,

Thank you for the screenshot.

The error occurs because the value passed to the DatePicker is a date string, but the component is expecting a valid date object to be passed.

As for the change event, it will return a date object with date and time, but the time will be set to 00:00:00 which should not cause side effects.

If there are additional requirements, please share more details about the desired end result.

Regards,
Stefan
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Wrappers for React
Asked by
Parag
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or