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 ) {
71
71
var week = result [ result . length ] = {
72
72
days : [ ]
73
73
} ;
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 ] = {
76
76
lead : printDate . getMonth ( ) != date . getMonth ( ) ,
77
77
date : printDate . getDate ( ) ,
78
78
current : this . selected && this . selected . equal ( printDate ) ,
79
79
today : today . equal ( printDate )
80
- } ) ;
80
+ } ;
81
+ day . render = day . selectable = ! day . lead ;
82
+ this . eachDay ( day ) ;
81
83
// TODO use adjust("D", 1)?
82
84
printDate . setDate ( printDate . getDate ( ) + 1 ) ;
83
85
}
Original file line number Diff line number Diff line change 36
36
$ ( "#datepicker-inline" ) . datepicker ( {
37
37
select : function ( event , ui ) {
38
38
$ ( "#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
+ }
39
54
}
40
55
} ) ;
41
56
$ ( "#datepicker, #datepicker2" ) . datepicker ( ) ;
64
79
< tr >
65
80
{ { each ( index , day ) week . days} }
66
81
< 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 = "#" >
69
85
${ day . date }
70
86
</ 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 } }
71
93
{ { / i f } }
72
94
</td >
73
95
{ { / e a c h } }
Original file line number Diff line number Diff line change 7
7
8
8
$ . widget ( "ui.datepicker" , {
9
9
options : {
10
+ eachDay : $ . noop
10
11
} ,
11
12
_create : function ( ) {
12
13
var self = this ;
13
14
this . date = $ . date ( ) ;
15
+ this . date . eachDay = this . options . eachDay ;
14
16
if ( this . element . is ( "input" ) ) {
15
17
self . _bind ( {
16
18
click : "open" ,
You can’t perform that action at this time.
0 commit comments