File tree Expand file tree Collapse file tree 3 files changed +31
-5
lines changed
Expand file tree Collapse file tree 3 files changed +31
-5
lines changed Original file line number Diff line number Diff line change @@ -71,13 +71,15 @@ $.date = function ( datestring, formatstring ) {
7171 var week = result [ result . length ] = {
7272 days : [ ]
7373 } ;
74- for ( var day = 0 ; day < 7 ; day ++ ) {
75- week . days . push ( {
74+ for ( var dayx = 0 ; dayx < 7 ; dayx ++ ) {
75+ var day = week . days [ week . days . length ] = {
7676 lead : printDate . getMonth ( ) != date . getMonth ( ) ,
7777 date : printDate . getDate ( ) ,
7878 current : this . selected && this . selected . equal ( printDate ) ,
7979 today : today . equal ( printDate )
80- } ) ;
80+ } ;
81+ day . render = day . selectable = ! day . lead ;
82+ this . eachDay ( day ) ;
8183 // TODO use adjust("D", 1)?
8284 printDate . setDate ( printDate . getDate ( ) + 1 ) ;
8385 }
Original file line number Diff line number Diff line change 3636 $ ( "#datepicker-inline" ) . datepicker ( {
3737 select : function ( event , ui ) {
3838 $ ( "#inline-output" ) . val ( ui . date ) ;
39+ } ,
40+ eachDay : function ( day ) {
41+ if ( day . lead && day . date > 20 ) {
42+ day . selectable = false ;
43+ day . render = true ;
44+ day . title = "These are the days of last month" ;
45+ day . extraClasses = "ui-state-disabled" ;
46+ }
47+ if ( day . date == 1 ) {
48+ day . extraClasses = "ui-state-error" ;
49+ day . title = "Something bad explaining the error highlight" ;
50+ }
51+ if ( day . today ) {
52+ day . title = "A good day!" ;
53+ }
3954 }
4055 } ) ;
4156 $ ( "#datepicker, #datepicker2" ) . datepicker ( ) ;
6479 < tr >
6580 { { each ( index , day ) week . days} }
6681 < td >
67- { { if ! day . lead } }
68- < a class = "ui-state-default{{if day.current}} ui-state-active{{/if}}{{if day.today}} ui-state-highlight{{/if}}" href = "#" >
82+ { { if day . render} }
83+ { { if day . selectable} }
84+ < a title = "${day.title}" class = "ui-state-default{{if day.current}} ui-state-active{{/if}}{{if day.today}} ui-state-highlight{{/if}} ${day.extraClasses}" href = "#" >
6985 ${ day . date }
7086 </ a >
87+ { { / i f } }
88+ { { if ! day . selectable } }
89+ < span title = "${day.title}" class = "{{if day.current}} ui-state-active{{/if}}{{if day.today}} ui-state-highlight{{/if}} ${day.extraClasses}" >
90+ ${ day . date }
91+ </ span >
92+ { { / i f } }
7193 { { / i f } }
7294 </td >
7395 { { / e a c h } }
Original file line number Diff line number Diff line change 77
88$ . widget ( "ui.datepicker" , {
99 options : {
10+ eachDay : $ . noop
1011 } ,
1112 _create : function ( ) {
1213 var self = this ;
1314 this . date = $ . date ( ) ;
15+ this . date . eachDay = this . options . eachDay ;
1416 if ( this . element . is ( "input" ) ) {
1517 self . _bind ( {
1618 click : "open" ,
You can’t perform that action at this time.
0 commit comments