Skip to content

Commit 7adf5bf

Browse files
committed
Datepicker: Fix the eachDay option (until we have a better design), use that in other-months demo. Fix handling of extraClasses property, split on space.
1 parent cb3f565 commit 7adf5bf

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

demos/datepicker/other-months.html

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,13 @@
1717
<script>
1818
$(function() {
1919
$( "#datepicker" ).datepicker({
20-
showOtherMonths: true,
21-
selectOtherMonths: true
20+
eachDay: function( day ) {
21+
if ( day.lead ) {
22+
day.render = true;
23+
day.selectable = true;
24+
day.extraClasses = "ui-priority-secondary";
25+
}
26+
}
2227
});
2328
});
2429
</script>

external/date.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,9 @@ $.date = function( datestring, formatstring ) {
130130
today: today.equal( printDate )
131131
};
132132
day.render = day.selectable = !day.lead;
133-
// TODO undefined in picker demos, fix it
134-
// this.eachDay( day );
133+
if ( this.eachDay ) {
134+
this.eachDay( day );
135+
}
135136
// TODO use adjust("D", 1)?
136137
printDate.setDate( printDate.getDate() + 1 );
137138
}

ui/jquery.ui.datepicker.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ $.widget( "ui.datepicker", {
459459
classes.push( "ui-state-highlight" );
460460
}
461461
if ( day.extraClasses ) {
462-
classes.push( day.extraClasses.split( "" ) );
462+
classes.push( day.extraClasses.split( " " ) );
463463
}
464464

465465
link = "<a href='#' tabindex='-1' data-timestamp='" + day.timestamp + "' class='" + classes.join( " " ) + "'>" +
@@ -478,7 +478,7 @@ $.widget( "ui.datepicker", {
478478
classes.push( "ui-state-highlight" );
479479
}
480480
if ( day.extraClasses ) {
481-
classes.push( day.extraClasses.split( "" ) );
481+
classes.push( day.extraClasses.split( " " ) );
482482
}
483483

484484
return "<span class='" + classes.join( "" ) + "'>" +

0 commit comments

Comments
 (0)