javascript - Why datepicker show same month when change month on a first time on autoOpening second datepicker -
- click on first field;
- select day; (then automatic opening second datepicker)
- click next month button
- showing datepicker has flash, month not change
- after this, next month button (and prev month button) have work.
whyyyyyyy ?????
$(".from_date").datepicker({ mindate: 'd', dateformat: "dd/mm/yy", defaultdate: "+1w", numberofmonths: 2, onclose: function(selecteddate) { $(".to_date").datepicker("option", "mindate", selecteddate); $(this).parents('.span2').next().children().find('.to_date').focus(); } }); $(".to_date").datepicker({ mindate: '+1d', dateformat: "dd/mm/yy", defaultdate: "+1w", numberofmonths: 2 });
i can confirm bug, has opening second datepicker onclose
function, adding 0 delay timeout seems work though:
onclose: function(selecteddate) { var $todate = $(this).closest('.span2').next().find('.to_date'); $todate.datepicker("option", "mindate", selecteddate); settimeout(function(){$todate.datepicker('show')},0); }
note: changed code bit, optimized .to_date
selector , made corresponding input updated selected date
Comments
Post a Comment