ng-matero/extensions

Datetimepicker validation issue if not required

JBBianchi opened this issue · 1 comments

Hello,

I found a strange behavior (in v17 at least, I didn't try in v18):

When binding a non required form control's input with the mtx-datetimepicke control, it looks like the related form's validity is messed up with.

After the first render, the form is invalid even though the target value is not required.

Filling the input with any value and then removing the value makes the form valid again.

I would expect the form to be valid right from the start.

See this StackBlitz sample

Please use other adapter instead of native adapter #141

If you use native adapter, please set default value null

form = this.fb.group({
  dueDate: [null],
});

https://stackblitz.com/edit/nk9byo-uy4zgu?file=src%2Fexample%2Fdatepicker-overview-example.ts