'How to use HTML input "time" with Angular FormGroup?
I want to allow user edit only time in my datetime form-field, but when user submits form the value is null
<form [formGroup]="activityForm" (ngSubmit)="onSubmit()">
<mat-form-field>
<input matInput type="time" formControlName="dateTo">
</mat-form-field>
</form>
I found that this works when the input type is set to "text" but with "time" somewhat does not.
Solution 1:[1]
I was confused by 12h format, with was default. Thought the last two digits supposed to be seconds not AM/PM, that is why I was getting null.
There is no support for input=time in Firefox:
link
Thanks @Meqwz for examples:
- Firefox 96.0 form field example
- Chromium form field example
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Micha? Witkowski |
