Add ability to move selector boxes (month/year) to any displayed month

Add ability to move selector boxes (month/year) to any displayed month

Current situation: The selector boxes for month/year appear on the first month displayed in a multi-month layout, however if you have the active month set other than the first position, the selection of months is non-intuitive. The month you select in the selectors is not the month that then appears below the selectors, leading to user confusion when selecting dates.

Example: with option showCurrentAtPos = 1
  1. [October] ------------ [November] ----------- [December]
  2. ^ Selector here       ^ Chosen month      ^ Following month

Proposed is an additional option (and this would still be valid for the rewrite) showSelectorAtPos, which allows for the selector to be moved to any of the valid positions, and would take the month/year details from the position it was in. In the case where showCurrentAtPos = 1 and showSelectorAtPos = 1, you would have

  1. [October] ------------ [November] -------------------------- [December]
  2. ^Previous month       ^ Chosen month & selector  ^ Following month

This can be implemented in the current branch (pull request already rejected though due to upcoming changes) with the following (diff against the full current .zip version of datepicker.js):

  1. diff jquery-ui.js jquery-ui.new.js
  2. 3885c3885,3886
  3. <               showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
  4. ---
  5. >               showCurrentAtPos: 0, // The position in multiple months at which to show the current month (starting at 0)
  6. >               showSelectorAtPos: 0, // The position in multiple months to show the selector
  7. 5464a5466,5467
  8. >               showSelectorAtPos = this._get(inst, "showSelectorAtPos");
  9. >               if (showSelectorAtPos<0 || showSelectorAtPos>=( ( ( numMonths[ 0 ] - 1 ) * numMonths[ 1 ] ) + numMonths[ 1 ] ) ) {
  10.                         showSelectorAtPos=0;
  11.                  }
    5492c5495
  12. <                                       row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers
    ---
  13. >                                       (row * numMonths[ 1 ] + col ) !== showSelectorAtPos, monthNames, monthNamesShort) + // draw month headers


Closed/rejected pull request 1668 demonstrates the proposal.

(Note: Could not get Trac to play nicely enough to allow me to register, login or post this as an issue for discussion there - errors on every page).