mat-datepicker -Changing Date when Manually inserted
Code Snippet:
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="picker"
id="startdate"
class="form-control"
name="startdate"
formControlName="startdate"
type="text">
<mat-datepicker-toggle matSuffix [for]="picker" ></mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
whenever I insert dates manually example 23/32/2017(dd/mm/yyyy) in my angular 4 application -the date control is sending Fri Aug 02 2019 00:00:00 GMT+0100 (GMT Standard Time) rather than throwing validation problem as 32 cannot be considered as a month. I have 2 questions here -
- How can I restrict the datepicker module to change the dates in the background(it should be same as what the user is entering)?
- whenever user enters 2 digits in the year field, datepicker amend the year value with the corresponding century value. how can we restrict the user to insert the complete year value?
All the above question is related to Angular 2/4.
Thanks
I have the same problem. Whenever I insert manually date with european format (dd/mm/yyyy) input is displaying like invalid with red line below.