diff options
author | Keith Wood <kbwood.au@gmail.com> | 2009-07-29 08:33:33 +0000 |
---|---|---|
committer | Keith Wood <kbwood.au@gmail.com> | 2009-07-29 08:33:33 +0000 |
commit | 20e13a4d772466e4cf9b455a76ea9f4d5be1c0b9 (patch) | |
tree | 4e4067d743ba84a4e56afd0df674f8e3145b75e0 /ui/ui.datepicker.js | |
parent | e84694a0c456895234b2686aeab72be69f3dbf74 (diff) | |
download | jquery-ui-20e13a4d772466e4cf9b455a76ea9f4d5be1c0b9.tar.gz jquery-ui-20e13a4d772466e4cf9b455a76ea9f4d5be1c0b9.zip |
Datepicker: Fixed #4131 Could week numbers [be] added to the Datepicker
Diffstat (limited to 'ui/ui.datepicker.js')
-rw-r--r-- | ui/ui.datepicker.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/ui/ui.datepicker.js b/ui/ui.datepicker.js index 295fd0aba..716e8e2d2 100644 --- a/ui/ui.datepicker.js +++ b/ui/ui.datepicker.js @@ -50,6 +50,7 @@ function Datepicker() { dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday + weekHeader: 'Wk', // Column header for week of the year dateFormat: 'mm/dd/yy', // See format options on parseDate firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ... isRTL: false, // True if right-to-left language, false if left-to-right @@ -77,6 +78,7 @@ function Datepicker() { // either relative to current year (-nn:+nn) or absolute (nnnn:nnnn) showOtherMonths: false, // True to show dates in other months, false to leave blank selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable + showWeek: false, // True to show week of the year, false to not show it calculateWeek: this.iso8601Week, // How to calculate the week of the year, // takes a Date and returns the number of the week for it shortYearCutoff: '+10', // Short year values < this are in the current century, @@ -1366,6 +1368,7 @@ $.extend(Datepicker.prototype, { '>' + currentText + '</button>' : '') + (isRTL ? '' : controls) + '</div>' : ''; var firstDay = parseInt(this._get(inst, 'firstDay'),10); firstDay = (isNaN(firstDay) ? 0 : firstDay); + var showWeek = this._get(inst, 'showWeek'); var dayNames = this._get(inst, 'dayNames'); var dayNamesShort = this._get(inst, 'dayNamesShort'); var dayNamesMin = this._get(inst, 'dayNamesMin'); @@ -1399,7 +1402,7 @@ $.extend(Datepicker.prototype, { row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers '</div><table class="ui-datepicker-calendar"><thead>' + '<tr>'; - var thead = ''; + var thead = (showWeek ? '<th class="ui-datepicker-week-col">' + this._get(inst, 'weekHeader') + '</th>' : ''); for (var dow = 0; dow < 7; dow++) { // days of the week var day = (dow + firstDay) % 7; thead += '<th' + ((dow + firstDay + 6) % 7 >= 5 ? ' class="ui-datepicker-week-end"' : '') + '>' + @@ -1414,7 +1417,8 @@ $.extend(Datepicker.prototype, { var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays)); for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows calender += '<tr>'; - var tbody = ''; + var tbody = (!showWeek ? '' : '<td class="ui-datepicker-week-col">' + + this._get(inst, 'calculateWeek')(printDate) + '</td>'); for (var dow = 0; dow < 7; dow++) { // create date picker days var daySettings = (beforeShowDay ? beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, '']); |