@@ -155,6 +155,40 @@ describe('md-date-picker', function() {
155155 expect ( controller . ngModelCtrl . $error [ 'maxdate' ] ) . toBe ( true ) ;
156156 } ) ;
157157
158+ it ( 'should ignore the time portion when comparing max-date' , function ( ) {
159+ // Given that selected date is the same day as maxdate but at a later time.
160+ pageScope . maxDate = new Date ( 2015 , JAN , 1 , 5 , 30 ) ;
161+ pageScope . myDate = new Date ( 2015 , JAN , 1 , 7 , 30 ) ;
162+ pageScope . $apply ( ) ;
163+
164+ expect ( controller . ngModelCtrl . $error [ 'maxdate' ] ) . toBeFalsy ( ) ;
165+ } ) ;
166+
167+ it ( 'should ignore the time portion when comparing min-date' , function ( ) {
168+ // Given that selected date is the same day as mindate but at an earlier time.
169+ pageScope . minDate = new Date ( 2015 , JAN , 1 , 5 , 30 ) ;
170+ pageScope . myDate = new Date ( 2015 , JAN , 1 ) ;
171+ pageScope . $apply ( ) ;
172+
173+ expect ( controller . ngModelCtrl . $error [ 'mindate' ] ) . toBeFalsy ( ) ;
174+ } ) ;
175+
176+ it ( 'should allow selecting a date exactly equal to the max-date' , function ( ) {
177+ pageScope . maxDate = new Date ( 2015 , JAN , 1 ) ;
178+ pageScope . myDate = new Date ( 2015 , JAN , 1 ) ;
179+ pageScope . $apply ( ) ;
180+
181+ expect ( controller . ngModelCtrl . $error [ 'maxdate' ] ) . toBeFalsy ( ) ;
182+ } ) ;
183+
184+ it ( 'should allow selecting a date exactly equal to the min-date' , function ( ) {
185+ pageScope . minDate = new Date ( 2015 , JAN , 1 ) ;
186+ pageScope . myDate = new Date ( 2015 , JAN , 1 ) ;
187+ pageScope . $apply ( ) ;
188+
189+ expect ( controller . ngModelCtrl . $error [ 'mindate' ] ) . toBeFalsy ( ) ;
190+ } ) ;
191+
158192 describe ( 'inside of a form element' , function ( ) {
159193 var formCtrl ;
160194
0 commit comments