angular-material-components
angular-material-components copied to clipboard
[bug] Setting `(focus)="picker.open()"` cause the selected datetime not being updated on next opening
Hi and thanks for your work,
When opened trough (focus)="picker.open()"
on the input
element, the inner selected datetime is not being updated when you reopen it the next time.
Stackblitz :
https://stackblitz.com/edit/demo-ngx-mat-datetime-picker-angular9-tpxldn?file=src%2Fapp%2Fapp.component.html
(Its basically the same sketch as in the README with (focus)="picker.open()"
added on the input element)
Step to reproduce :
- Click somewhere on the
input
element (elsewhere than on the calendar icon) to open the datepicker - Change the date or the time
- Click on the validate button
- Open the datepicker again : The displayed datetime in the datepicker is not reflecting the input value, it's showing the old value
Using click
instead of focus
doesn't fix it neither.
Hi @h2qutc sorry to bother you but do you have any quick workaround to do this ? From usage code or even from the package itself I could patch with patch-package, I'll take
I find a workaround by replacing (focus)="picker.open()"
with (focus)="picker._selected = formControl.value; picker.open()"
, with formControl.value
refering to the datetime value