jquery - jQueryUI datepicker formatted date range clearing its partner on new date -
i have 2 input fields, displaying from , to month/year. no date should selected, month , year relevant, first day in month used.
they have alt field each, send proper value server.
however, whenever date has been selected in 1 field, , min or maxdate gets set on other, 1 clear field. have done extensive debugging of values passed, , have been able narrow down formatting of date being issue. can't seem think of why be, however, code used, parse , create proper date.
line 13, , 40 triggers error:
$('#user_range2').datepicker('option', 'mindate', $('#user_range1').datepicker('getdate'));
i experimented several jquery versions on jsfiddle, , none appeared have fix.
does know how can keep formatting, , work intended?
update
i've narrowed down issue. since there's no date in format, following line throw exception (from jqueryui.js@parsedate()):
date = this._daylightsavingadjust(new date(year, month - 1, day)); if (date.getfullyear() !== year || date.getmonth() + 1 !== month || date.getdate() !== day) { throw "invalid date"; // e.g. 31/02/00 }
unless there's way circumvent that, seems impossible not have date in format, when wanting limit range of 2 fields.
this works fine me:
from date:
$( "#datepicker_start" ).datepicker({ onclose: function( selecteddate ) { $( "#datepicker_end" ).datepicker( "option", "maxdate", selecteddate ); } });
to date:
$( "#datepicker_end" ).datepicker({ onclose: function( selecteddate ) { $( "#datepicker_start" ).datepicker( "option", "maxdate", selecteddate ); } });
Comments
Post a Comment