Opened 12 years ago
Last modified 7 years ago
#7580 open feature
Datepicker: Ability to position current month out of view with showCurrentAtPos option
Reported by: | copesc | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | none |
Component: | ui.datepicker | Version: | 1.8.14 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Hi, I've made a small jsfiddle to clarify the issue:
If you go forward to january 2012, the first 2 months are undefined, when showCurrentAtPos is set as -2. If I set showCurrentAtPos: -1, the first month is undefined.
Change History (5)
comment:1 Changed 12 years ago by
Status: | new → open |
---|
comment:2 Changed 10 years ago by
Milestone: | 1.9.0 → 1.11.0 |
---|
comment:3 Changed 10 years ago by
Summary: | Using showCurrentAtPos gives an undefined month when changing year → Datepicker: Ability to position current month out of view with showCurrentAtPos option |
---|---|
Type: | bug → feature |
comment:4 Changed 9 years ago by
Milestone: | 1.11.0 → none |
---|
comment:5 Changed 7 years ago by
I found a solution and patched the jquery-ui.js in basically two code lines in the datepicker subroutines _adjustDate() and _updateDatepicker() (see also cross-posting in http://bugs.jqueryui.com/ticket/9923#comment:4 ):
--- jquery-ui.orig.js 2015-11-23 20:04:52.000000000 +0100 +++ jquery-ui.js 2015-11-23 17:56:37.987111191 +0100 @@ -8815,6 +8815,8 @@ origyearshtml = inst.yearshtml = null; }, 0); } + // FIX BUG http://bugs.jqueryui.com/ticket/7288 + inst.drawMonth += this._get(inst, "showCurrentAtPos"); }, // #6694 - don't focus the input if it's already focused @@ -8940,9 +8942,14 @@ if (this._isDisabledDatepicker(target[0])) { return; } + // FIX BUG http://bugs.jqueryui.com/ticket/7288 + /* this._adjustInstDate(inst, offset + (period === "M" ? this._get(inst, "showCurrentAtPos") : 0), // undo positioning period); + */ + this._adjustInstDate(inst, offset, period); + this._updateDatepicker(inst); },
Note: See
TracTickets for help on using
tickets.
Changing to a feature request. I'm pretty sure
showCurrentAtPost
was never meant to be used with the current month out of view.Updated test case: http://jsfiddle.net/Hsy5w/1/