I have this piece of code in my html:
<mat-form-field>
<input matInput [matDatepicker]="myDatepicker" placeholder="Choose a date" [(ngModel)]="model.value" name="value">
<mat-datepicker-toggle matSuffix [for]="myDatepicker"></mat-datepicker-toggle>
<mat-datepicker #myDatepicker></mat-datepicker>
</mat-form-field>
With this i'm able to get date with this format: YYY-MM-DDThh:mm:ss:millisZ
.
Using matDatepicker i'm able to select the date but i need after the date selection to select the time too.
Is possible to achieve this result using matDatepicker ONLY?
Thanks
No, as of now, it is not possible to choose time
from matDatePicker
. There is still an open issue on github regarding this feature.
Summary of the issue thread :
Alternatively you can use one of the following to have dateTimePicker
for your project.
MaterialTimeControl - Material Design with Angular Material, CDK, and Flex Layouts
amazing-time-picker - Not built with Angular Material, but built to be compatible with it
date-time-picker - Not fully Material Design, but built with the CDK
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With