Open santaclaus21 opened 8 years ago
The problem is that:
$('#data_do_' + idy).datepicker('option', {minDate: min});
should working like:
$('#data_do_' + idy).datepicker('option', {minDate: min, minDateTime: min});
$('#data_do_' + idy).val(dateStr);
And final, almost working for me code:
$('input[id^="data_od"]').datetimepicker({
stepMinute: 10,
minDate: null,
onSelect: function(dateStr) {
var idy = $(this).attr("id").substr(8);
var min = $(this).datepicker('getDate') || new Date(); // Selected date or today if none
$('#data_do_' + idy).datepicker('option', {minDate: min, minDateTime: min});
$('#data_do_' + idy).val(dateStr);
}
});
$('input[id^="data_do"]').datetimepicker({
stepMinute: 10,
minDate: null,
onSelect: function(dateStr) {
var idy = $(this).attr("id").substr(8);
var max = $(this).datepicker('getDate');
$('#data_od_' + idy).datepicker('option', {maxDate: max, maxDateTime: max});
}
});
I'he got 2 fields "data_od_0" and "data_do_0". First is like "start date time" and second one like "end date time". So second one can't be lower than the first on. So I have to use both option "minDate" and "minDateTime" because the first one set only date and second one create limit for data_do_0. Additional, "minDate" [sets only date of field] and "minDateTime" [sets only limit, with no change in inputs]. After this manipulation I have to set manualy second filed $('#datado' + idy).val(dateStr), because of minDate set only date and minDateTime sets nothing on field - only limit... I'm a little confused. Even example on homepage isn't working fine (?!).