File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed
src/material/core/datetime Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -176,7 +176,7 @@ export class NativeDateAdapter extends DateAdapter<Date> {
176176 return new Date ( value ) ;
177177 }
178178
179- const dateParts = ( value as string )
179+ const dateParts = value
180180 . trim ( )
181181 . split ( DATE_COMPONENT_SEPARATOR_REGEX )
182182 . map ( part => parseInt ( part , 10 ) )
@@ -221,13 +221,14 @@ export class NativeDateAdapter extends DateAdapter<Date> {
221221 }
222222 }
223223
224- if (
225- year !== null &&
226- month !== null &&
227- day !== null &&
228- this . _dateComponentsAreValid ( year , month , day )
229- ) {
230- return this . createDate ( year , month , day ) ;
224+ if ( year !== null && month !== null && day !== null ) {
225+ const date = this . createDate ( year , month , day ) ;
226+
227+ if ( date . getFullYear ( ) === year && date . getMonth ( ) === month && date . getDate ( ) === day ) {
228+ return date ;
229+ }
230+
231+ return this . invalid ( ) ;
231232 }
232233
233234 return this . _nativeParseFallback ( value ) ;
You can’t perform that action at this time.
0 commit comments