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

DateTimePicker remembers prev time value

3 Answers 143 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
VasVas
Top achievements
Rank 1
VasVas asked on 31 May 2015, 06:31 AM

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

3 Answers, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 02 Jun 2015, 03:24 PM

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!
 
0
VasVas
Top achievements
Rank 1
answered on 04 Jun 2015, 08:07 AM

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

0
Boyan Dimitrov
Telerik team
answered on 08 Jun 2015, 08:22 AM

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!
 
Tags
Date/Time Pickers
Asked by
VasVas
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
VasVas
Top achievements
Rank 1
Share this question
or