Skip to content

Commit d17341d

Browse files
committed
Datepicker: Re-implementing the showWeek option based on the builder methods.
1 parent e1b6cdc commit d17341d

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

datepicker-rewrite/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ <h2>Older Templates:</h2>
6767
}
6868
});
6969
$( "#datepicker-inline" ).datepicker( {
70-
tmpl: "#ui-datepicker-weeks-tmpl",
70+
showWeek: true,
7171
select: function( event, ui ) {
7272
$( "#inline-output" ).val( ui.date );
7373
},

datepicker-rewrite/picker.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ $.widget( "ui.datepicker", {
1919
my: "left top",
2020
at: "left bottom"
2121
},
22+
showWeek: false,
2223
show: true,
2324
hide: true,
2425

@@ -326,7 +327,12 @@ $.widget( "ui.datepicker", {
326327
},
327328
_buildGridHeading: function() {
328329
var cells = "",
329-
i = 0;
330+
i = 0,
331+
labels = Globalize.localize( "datepicker" );
332+
333+
if ( this.options.showWeek ) {
334+
cells += "<th>" + labels.weekHeader + "</th>";
335+
}
330336
for ( i; i < this.date.weekdays().length; i++ ) {
331337
cells += this._buildGridHeaderCell( this.date.weekdays()[i] );
332338
}
@@ -352,6 +358,10 @@ $.widget( "ui.datepicker", {
352358
_buildWeekRow: function( week ) {
353359
var cells = "",
354360
i = 0;
361+
362+
if ( this.options.showWeek ) {
363+
cells += "<td>" + week.number + "</td>";
364+
}
355365
for ( i; i < week.days.length; i++ ) {
356366
cells += this._buildDayCell( week.days[i] );
357367
}

0 commit comments

Comments
 (0)