@@ -34,7 +34,6 @@ import {
3434import { DateAdapter , MAT_DATE_FORMATS , MatDateFormats } from '@angular/material/core' ;
3535import { MatFormField } from '@angular/material/form-field' ;
3636import { Subscription } from 'rxjs/Subscription' ;
37- import { coerceDateProperty } from './coerce-date-property' ;
3837import { MatDatepicker } from './datepicker' ;
3938import { createMissingDateImplError } from './datepicker-errors' ;
4039
@@ -113,7 +112,7 @@ export class MatDatepickerInput<D> implements AfterContentInit, ControlValueAcce
113112 return this . _value ;
114113 }
115114 set value ( value : D | null ) {
116- value = coerceDateProperty ( this . _dateAdapter , value ) ;
115+ value = this . _dateAdapter . coerceToDate ( value ) ;
117116 this . _lastValueValid = ! value || this . _dateAdapter . isValid ( value ) ;
118117 value = this . _getValidDateOrNull ( value ) ;
119118
@@ -131,7 +130,7 @@ export class MatDatepickerInput<D> implements AfterContentInit, ControlValueAcce
131130 @Input ( )
132131 get min ( ) : D | null { return this . _min ; }
133132 set min ( value : D | null ) {
134- this . _min = coerceDateProperty ( this . _dateAdapter , value ) ;
133+ this . _min = this . _dateAdapter . coerceToDate ( value ) ;
135134 this . _validatorOnChange ( ) ;
136135 }
137136 private _min : D | null ;
@@ -140,7 +139,7 @@ export class MatDatepickerInput<D> implements AfterContentInit, ControlValueAcce
140139 @Input ( )
141140 get max ( ) : D | null { return this . _max ; }
142141 set max ( value : D | null ) {
143- this . _max = coerceDateProperty ( this . _dateAdapter , value ) ;
142+ this . _max = this . _dateAdapter . coerceToDate ( value ) ;
144143 this . _validatorOnChange ( ) ;
145144 }
146145 private _max : D | null ;
@@ -188,23 +187,23 @@ export class MatDatepickerInput<D> implements AfterContentInit, ControlValueAcce
188187
189188 /** The form control validator for the min date. */
190189 private _minValidator : ValidatorFn = ( control : AbstractControl ) : ValidationErrors | null => {
191- const controlValue = coerceDateProperty ( this . _dateAdapter , control . value ) ;
190+ const controlValue = this . _dateAdapter . coerceToDate ( control . value ) ;
192191 return ( ! this . min || ! controlValue ||
193192 this . _dateAdapter . compareDate ( this . min , controlValue ) <= 0 ) ?
194193 null : { 'matDatepickerMin' : { 'min' : this . min , 'actual' : controlValue } } ;
195194 }
196195
197196 /** The form control validator for the max date. */
198197 private _maxValidator : ValidatorFn = ( control : AbstractControl ) : ValidationErrors | null => {
199- const controlValue = coerceDateProperty ( this . _dateAdapter , control . value ) ;
198+ const controlValue = this . _dateAdapter . coerceToDate ( control . value ) ;
200199 return ( ! this . max || ! controlValue ||
201200 this . _dateAdapter . compareDate ( this . max , controlValue ) >= 0 ) ?
202201 null : { 'matDatepickerMax' : { 'max' : this . max , 'actual' : controlValue } } ;
203202 }
204203
205204 /** The form control validator for the date filter. */
206205 private _filterValidator : ValidatorFn = ( control : AbstractControl ) : ValidationErrors | null => {
207- const controlValue = coerceDateProperty ( this . _dateAdapter , control . value ) ;
206+ const controlValue = this . _dateAdapter . coerceToDate ( control . value ) ;
208207 return ! this . _dateFilter || ! controlValue || this . _dateFilter ( controlValue ) ?
209208 null : { 'matDatepickerFilter' : true } ;
210209 }
0 commit comments