File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -61,9 +61,14 @@ angular.module('g1b.datetime-range', []).
6161 }
6262 } ;
6363
64+ // Check if date is within bounds of min and max allowed date
65+ scope . isWithinBounds = function ( date ) {
66+ return ( ! scope . minDate || date > scope . minDate ) && ( ! scope . maxDate || date < scope . maxDate ) ;
67+ } ;
68+
6469 // Update selected date
6570 scope . setDate = function ( date , calendar_update ) {
66- if ( scope . selected . isSame ( date ) ) { return ; }
71+ if ( scope . selected . isSame ( date ) || ! scope . isWithinBounds ( date ) ) { return ; }
6772 if ( ( scope . selected === scope . start && date < scope . end ) || ( scope . selected === scope . end && date > scope . start ) ) {
6873 scope . selected . year ( date . year ( ) ) . month ( date . month ( ) ) . date ( date . date ( ) ) . hours ( date . hours ( ) ) . minutes ( date . minutes ( ) ) . seconds ( date . seconds ( ) ) ;
6974 if ( ( scope . selected . clone ( ) . startOf ( 'week' ) . month ( ) !== scope . calendar . month ( ) && scope . selected . clone ( ) . endOf ( 'week' ) . month ( ) !== scope . calendar . month ( ) ) || calendar_update ) {
You can’t perform that action at this time.
0 commit comments