DatePicker - Date Extraction

2 posts, 0 answers
  1. Parag
    Parag avatar
    49 posts
    Member since:
    Aug 2018

    Posted 29 Jan 2019 Link to this post

    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

  2. Stefan
    Admin
    Stefan avatar
    2913 posts

    Posted 30 Jan 2019 Link to this post

    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
Back to Top