File tree Expand file tree Collapse file tree 1 file changed +28
-15
lines changed
Expand file tree Collapse file tree 1 file changed +28
-15
lines changed Original file line number Diff line number Diff line change 1111 < link rel ="stylesheet " href ="../demos.css ">
1212 < script >
1313 $ ( function ( ) {
14- $ ( "#from" ) . datepicker ( {
15- defaultDate : "+1w" ,
16- changeMonth : true ,
17- numberOfMonths : 3 ,
18- onClose : function ( selectedDate ) {
19- $ ( "#to" ) . datepicker ( "option" , "minDate" , selectedDate ) ;
20- }
21- } ) ;
22- $ ( "#to" ) . datepicker ( {
23- defaultDate : "+1w" ,
24- changeMonth : true ,
25- numberOfMonths : 3 ,
26- onClose : function ( selectedDate ) {
27- $ ( "#from" ) . datepicker ( "option" , "maxDate" , selectedDate ) ;
14+ var dateFormat = "mm/dd/yy" ,
15+ from = $ ( "#from" )
16+ . datepicker ( {
17+ defaultDate : "+1w" ,
18+ changeMonth : true ,
19+ numberOfMonths : 3
20+ } )
21+ . on ( "change" , function ( ) {
22+ to . datepicker ( "option" , "minDate" , getDate ( this ) ) ;
23+ } ) ,
24+ to = $ ( "#to" ) . datepicker ( {
25+ defaultDate : "+1w" ,
26+ changeMonth : true ,
27+ numberOfMonths : 3
28+ } )
29+ . on ( "change" , function ( ) {
30+ from . datepicker ( "option" , "maxDate" , getDate ( this ) ) ;
31+ } ) ;
32+
33+ function getDate ( element ) {
34+ var date ;
35+ try {
36+ date = $ . datepicker . parseDate ( dateFormat , element . value ) ;
37+ } catch ( error ) {
38+ date = null ;
2839 }
29- } ) ;
40+
41+ return date ;
42+ }
3043 } ) ;
3144 </ script >
3245</ head >
You can’t perform that action at this time.
0 commit comments