File tree Expand file tree Collapse file tree 3 files changed +30
-6
lines changed Expand file tree Collapse file tree 3 files changed +30
-6
lines changed Original file line number Diff line number Diff line change @@ -75,14 +75,29 @@ $.date = function ( datestring, formatstring ) {
75
75
for ( var day = 0 ; day < 7 ; day ++ ) {
76
76
week . days . push ( {
77
77
lead : printDate . getMonth ( ) != month ,
78
- date : printDate . getDate ( )
78
+ date : printDate . getDate ( ) ,
79
+ current : this . selected && this . selected . equal ( printDate ) ,
80
+ today : today . equal ( printDate )
79
81
} ) ;
80
82
// use adjust("D", 1)?
81
83
printDate . setDate ( printDate . getDate ( ) + 1 ) ;
82
84
}
83
85
}
84
86
return result ;
85
87
} ,
88
+ select : function ( ) {
89
+ this . selected = this . clone ( ) ;
90
+ return this ;
91
+ } ,
92
+ clone : function ( ) {
93
+ return $ . date ( this . format ( ) , format ) ;
94
+ } ,
95
+ equal : function ( other ) {
96
+ function format ( date ) {
97
+ return $ . global . format ( date , "d" ) ;
98
+ }
99
+ return format ( date ) == format ( other ) ;
100
+ } ,
86
101
date : function ( ) {
87
102
return date ;
88
103
} ,
@@ -99,4 +114,6 @@ $.date = function ( datestring, formatstring ) {
99
114
}
100
115
}
101
116
117
+ var today = $ . date ( ) ;
118
+
102
119
} ( jQuery ) ) ;
Original file line number Diff line number Diff line change 43
43
</ script >
44
44
45
45
< script id ="ui-datepicker-tmpl " type ="text/x-jquery-tmpl ">
46
- < div id = "ui-datepicker-div" class = "ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all" >
46
+ < div class = "ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all" >
47
47
< div class = "ui-datepicker-header ui-widget-header ui-helper-clearfix ui-corner-all" >
48
48
< a class = "ui-datepicker-prev ui-corner-all" title = "Prev" > < span class = "ui-icon ui-icon-circle-triangle-w" > Prev</ span > </ a >
49
49
< a class = "ui-datepicker-next ui-corner-all" title = "Next" > < span class = "ui-icon ui-icon-circle-triangle-e" > Next</ span > </ a >
63
63
{ { each ( index , week ) date . days ( ) } }
64
64
< tr >
65
65
{ { each ( index , day ) week . days} }
66
- < td class = "" >
66
+ < td >
67
67
{ { if ! day . lead } }
68
- < a class = "ui-state-default" href = "#" > ${ day . date } </ a >
68
+ < a class = "ui-state-default{{if day.current}} ui-state-active{{/if}}{{if day.today}} ui-state-highlight{{/if}}" href = "#" >
69
+ ${ day . date }
70
+ </ a >
69
71
{ { / i f } }
70
72
</td >
71
73
{ { / e a c h } }
Original file line number Diff line number Diff line change @@ -38,10 +38,12 @@ $.widget( "ui.datepicker", {
38
38
this . picker . delegate ( ".ui-datepicker-calendar a" , "click" , function ( event ) {
39
39
event . preventDefault ( ) ;
40
40
// TODO exclude clicks on lead days or handle them correctly
41
- self . date . setDay ( + $ ( this ) . text ( ) ) ;
41
+ self . date . setDay ( + $ ( this ) . text ( ) ) . select ( ) ;
42
42
if ( ! self . inline ) {
43
43
self . element . val ( self . date . format ( ) ) ;
44
44
self . close ( ) ;
45
+ } else {
46
+ self . refresh ( ) ;
45
47
}
46
48
self . _trigger ( "select" , event , {
47
49
date : self . date . format ( ) ,
@@ -58,7 +60,10 @@ $.widget( "ui.datepicker", {
58
60
date : this . date
59
61
} ) . appendTo ( this . picker )
60
62
. find ( "button" ) . button ( ) . end ( )
61
-
63
+
64
+ if ( this . inline ) {
65
+ this . picker . children ( ) . addClass ( "ui-datepicker-inline" ) ;
66
+ }
62
67
// against display:none in datepicker.css
63
68
this . picker . find ( ".ui-datepicker" ) . css ( "display" , "block" ) ;
64
69
this . _hoverable ( this . picker . find ( ".ui-datepicker-header a" ) ) ;
You can’t perform that action at this time.
0 commit comments