@@ -118,7 +118,7 @@ export abstract class DateAdapter<D> {
118118 abstract today ( ) : D ;
119119
120120 /**
121- * Parses a date from a value.
121+ * Parses a date from a user-inputted value.
122122 * @param value The value to parse.
123123 * @param parseFormat The expected format of the value being parsed
124124 * (type is implementation-dependent).
@@ -127,7 +127,7 @@ export abstract class DateAdapter<D> {
127127 abstract parse ( value : any , parseFormat : any ) : D | null ;
128128
129129 /**
130- * Formats a date as a string.
130+ * Formats a date as a string according to the given format .
131131 * @param date The value to format.
132132 * @param displayFormat The format to use to display the date as a string.
133133 * @returns The formatted date string.
@@ -165,6 +165,8 @@ export abstract class DateAdapter<D> {
165165
166166 /**
167167 * Gets the RFC 3339 compatible string (https://tools.ietf.org/html/rfc3339) for the given date.
168+ * This method is used to generate date strings that are compatible with native HTML attributes
169+ * such as the `min` or `max` attribute of an `<input>`.
168170 * @param date The date to get the ISO date string for.
169171 * @returns The ISO date string date string.
170172 */
@@ -185,20 +187,23 @@ export abstract class DateAdapter<D> {
185187 abstract isValid ( date : D ) : boolean ;
186188
187189 /**
188- * Attempts to coerce a value to a valid date object. This is different from parsing in that it
189- * should only coerce non-ambiguous, locale-independent values (e.g. a ISO 8601 string).
190- * The default implementation does not allow any coercion, it simply checks that the given value
191- * is already a valid date object or null.
192- * @param value The value to be coerced to a date object.
193- * @returns The coerced date object, either a valid date, null if the value can be coerced to a
194- * null date (e.g. the empty string).
195- * @throws If the given value cannot be coerced to a valid date or null.
190+ * Attempts to deserialize a value to a valid date object. This is different from parsing in that
191+ * deserialize should only accept non-ambiguous, locale-independent values (e.g. a ISO 8601
192+ * string). The default implementation does not allow any deserialization, it simply checks that
193+ * the given value is already a valid date object or null. The `<mat-datepicker>` will call this
194+ * method on all of it's `@Input()` properties that accept dates. It is therefore possible to
195+ * support passing your wire format directly to these properties by overriding this method to
196+ * also deserialize your wire format.
197+ * @param value The value to be deserialized into a date object.
198+ * @returns The deserialized date object, either a valid date, null if the value can be
199+ * deserialized into a null date (e.g. the empty string).
200+ * @throws If the given value cannot be deserialized into a valid date or null.
196201 */
197- coerceToDate ( value : any ) : D | null {
202+ deserialize ( value : any ) : D | null {
198203 if ( value == null || this . isDateInstance ( value ) && this . isValid ( value ) ) {
199204 return value ;
200205 }
201- throw Error ( `Could not coerce "${ value } " to a valid date object.` ) ;
206+ throw Error ( `Could not deserialize "${ value } " into a valid date object.` ) ;
202207 }
203208
204209 /**
0 commit comments