DateTimePicker remembers prev time value

4 posts, 0 answers
  1. VasVas
    VasVas avatar
    31 posts
    Member since:
    Nov 2012

    Posted 31 May 2015 Link to this post

    Dear Telerik,

    I am using a DateTimePicker control in a kendo window that I use multiple times to add details for new data row.

    After I enter the first Date and Time 1/1/2013 9:00 I programaticly cleare the values bound to the control and the the value of the control itself. 

    $("#dateTimeControl1").data("kendoDateTimePicker").value(null); Then when the user selects an new date the default hour selected is the previous hour selected before. Could you explane why this is happenning and how to over come it.

     I am using 2015 first qorter version  of the mvc wapper version.

    Yours,

     

    Ariel

  2. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 02 Jun 2015 Link to this post

    Hello VasVas,

    I am not sure that I completely understand the problem you are facing. 

    When the value of the DateTimePicker is cleared and user selects a new date, the value method of the widget returns the date before clearing. 

    I prepare a sample http://dojo.telerik.com/OgiKa example to test the scenario. When the value is cleared and a new date is selected the button "Show current date" shows the newly selected date as expected.

    Please try to replicate the issue with this sample with some steps. 

    Regards,
    Boyan Dimitrov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
  4. VasVas
    VasVas avatar
    31 posts
    Member since:
    Nov 2012

    Posted 04 Jun 2015 in reply to Boyan Dimitrov Link to this post

    Dear Boyan,

    Thank you for your reply. The sample you prepared is just right for explaining the problemI will try to write the steps to reconstruction:select control value 1/1/2013 9:00click the button "clear the date" select only date 4/6/2015 The control shows 4/6/2015 9:00 and not 4/6/2015 00:00 as I expected
    How can I make the control work this way?
    Thanks 

    Ariel

  5. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 08 Jun 2015 Link to this post

    Hello VasVas,

    Indeed this is a misbehavior and I logged it as a bug to our system. 

    A simply workaround for this case would be setting the DateTimePicker widget value to a different date just before clearing the value. It will reset the time to 12:00 AM and then clear the value. So next time when a new date is selected from the calendar the time will be set to 12:AM.

    function clicked(){  
              $("#datepicker").data("kendoDateTimePicker").value(new Date(2014,1,1));       
              $("#datepicker").data("kendoDateTimePicker").value(null);
            }

     

    Regards,
    Boyan Dimitrov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top
Kendo UI is VS 2017 Ready