Search and Top Navigation
#13650 closed bug (duplicate)
Opened July 15, 2015 03:18AM UTC
Closed July 15, 2015 03:18PM UTC
datepicker incorrectly formats buttons when navigationAsDateFormat is set to true
Reported by: | JohnnyO63 | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | none |
Component: | ui.datepicker | Version: | 1.11.4 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
When using datepicker and setting the default for navigationAsDateFormat the buttons next, prev, and current return the correct date part formatted with the current values of nextText, prevText, and currentText. This is instead of using the current value of dateFormat.
i.e. the current date is '07/14/2015', the currentText is defaulting to 'Today', and the dateFormat is defaulting to 'mm/dd/yy'. When navigationAsDateFormat is true, the text shown on the current button is 'T19615a15' as the function formatDate() is trying to use the string 'Today' as a dateFormat instead of 'mm/dd/yy'.
in jquery-ui.js in datePicker._generateHTML(inst) you will find the following;
... prevText = this._get(inst, "prevText"); prevText = (!navigationAsDateFormat ? '''prevText''' : this.formatDate(prevText, this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)), this._getFormatConfig(inst))); ... nextText = this._get(inst, "nextText"); nextText = (!navigationAsDateFormat ? '''nextText''' : this.formatDate(nextText, this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)), this._getFormatConfig(inst))); ... currentText = this._get(inst, "currentText"); gotoDate = (this._get(inst, "gotoCurrent") && '''inst.currentDay''' ? currentDate : today); currentText = (!navigationAsDateFormat ? currentText : this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)));'' ...
It should be as follows;
... prevText = this._get(inst, "prevText"); prevText = (!navigationAsDateFormat ? '''this._get(inst, "dateFormat")''' : this.formatDate(prevText, this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)), this._getFormatConfig(inst))); ... nextText = this._get(inst, "nextText"); nextText = (!navigationAsDateFormat ? '''this._get(inst, "dateFormat")''' : this.formatDate(nextText, this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)), this._getFormatConfig(inst))); ... currentText = this._get(inst, "currentText"); gotoDate = (this._get(inst, "gotoCurrent") && inst.currentDay ? currentDate : today); currentText = (!navigationAsDateFormat ? '''this._get(inst, "dateFormat")''' : this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)));'' ...
made a correction in ticket #13651