Open Ugoku opened 9 years ago
+1
This happened to me too. The onSelect actually only breaks the initial value, like, it runs fine whatsoever. The time part is gone, leaving only e.g "2015-01-09 "
In Firefox console, there were several duplicate errors, for both the dates:
"Error parsing the date string: Extra/unparsed characters found in date: 19:00:00
date string = 2014-10-11 19:00:00
date format = yy-mm-dd"
"Error parsing the date string: Extra/unparsed characters found in date: 22:00:00
date string = 2014-10-11 22:00:00
date format = yy-mm-dd"
So I had to re-set the value, after the code block of the onSelect:
$("#date_start").datetimepicker("option", "onSelect", function (selectedDateTime) {
$("#date_end").datetimepicker('option', 'minDate', selectedDateTime );
});
$("#date_end").datetimepicker("option", "onSelect", function (selectedDateTime) {
$("#date_start").datetimepicker('option', 'maxDate', selectedDateTime );
});
$("#date_start").val(value here);
$("#date_end").val(value here);
Had this issue as well, but with both datetimepickers using altfields.
Turns out you need to set the option altFieldTimeOnly
to false in order to have the time entered into the input field. This defaults to true, so the altfield will receive only the time and the input field will receive only the date.
Situation: two datetimepickers, one for a start date, one for an end date. I pre-fill the elements in the format
dd-mm-yy HH:mm
which is also what I use in the options for both elements. So far, so good.However, when I use the
onSelect
option, things break:When I do this, the time is removed from the element. I don't even have to select anything, this happens as soon as the page is loaded. When I use the
onClose
option instead ofonSelect
, it works just fine. Looking at the code, I can't see what's wrong so unfortunately I can't submit a fix right now :(