Note that there are some explanatory texts on larger screens.

plurals
  1. POjQueryUI datepicker formatted date range clearing its partner on new date
    primarykey
    data
    text
    <p>I have two input fields, displaying a <strong>from</strong> and a <strong>to</strong> month/year. No date should be selected, only the month and year are actually relevant, so first day in the month is used.</p> <p>They also have an alt field each, to send a proper value to the server.</p> <p>However, whenever a date has been selected in one field, and the <strong>min</strong> or <strong>maxDate</strong> gets set on the other, that one will clear its field. I have done some extensive debugging of the values passed, and have only been able to narrow it down to the <strong>formatting</strong> of the date being the issue. I can't seem to think of why it would be, however, with the extra code used, to parse and create a proper date.</p> <p><a href="http://jsfiddle.net/ntGT4/1/" rel="nofollow">Jsfiddle</a></p> <p>Line 13, and 40 triggers the error:</p> <pre><code>$('#user_range2').datepicker('option', 'minDate', $('#user_range1').datepicker('getDate')); </code></pre> <p>I experimented with several jQuery versions on jsfiddle, and none appeared to have a fix.</p> <p>Does anyone know how I can keep the formatting, and get it to work as intended?</p> <p><strong>Update</strong></p> <p>I've narrowed it down to the issue. Since there's no date in the format, the following line will throw an exception (from jqueryui.js@<em>parseDate()</em>):</p> <pre><code>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 } </code></pre> <p>Unless there's a way to circumvent that, it seems to be impossible to not have a date in the format, when wanting to limit the range of two fields.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload