You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm having this problem too, basically the issue is that setting the defaultDate with the FlatpickrOptions shows the value in the input but does not update the value in the Reactive Form Control itself. So on top of using the defaultDate, I also have to set it with the Reactive Form controls.
So if we take the example from original question
dateOptions: FlatpickrOptions={defaultDate: newDate(),locale: Pt.pt,dateFormat:'d/m/Y'};// doing this extra command does workmyForm=formBuilder.group({dtaInicio : [newDate()],// <<-- SET IT HERE TOO});
That works but it's a little confusing not knowing that the defaultDate doesn't work from the get go.
here s my code:
dateOptions: FlatpickrOptions = {
defaultDate: new Date(),
locale: Pt.pt,
dateFormat:'d/m/Y'
};
myForm = formBuilder.group({
...
dtaInicio : [''],
dtaFim : [''],
});
<ng2-flatpickr formControlName="dtaInicio" [config]="dateOptions" >
myForm.value.dtaInicio and myForm.value.dtaFim comes always empty!
The text was updated successfully, but these errors were encountered: