Skip to content

docs-bug(datepicker): Usage with signal forms #65468

@anisabboud

Description

@anisabboud

Documentation Feedback

Can you please add an example of using mat-datepicker with signal forms?

I tried to use it with a Date field, but I'm getting a typescript error:

Type 'Date' is not assignable to type 'string'.ngtsc(2322)
Image

Typescript is saying that:

  • field is of type Field<Date>.field: InputSignal<FieldTree<Date, string | number>>
  • reportForm.reportDate is of type FieldTree<Date, string> (not sure where the string came from)

Simple form setup:

  formModel = signal({
    reportDate: new Date(),
  });
  reportForm = form(this.formModel);

Affected documentation page

https://material.angular.dev/components/datepicker/examples

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions