Skip to content

bug(Datepicker): Signal Forms - [Error] TS2322: Type 'Date' is not assignable to type 'string'. #32436

@lpl14

Description

@lpl14

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

If I try to use Datepicker similar to this example from Setting the selected date but with signal forms i get a compile time error:

✘ [ERROR] TS2322: Type 'Date' is not assignable to type 'string'. [plugin angular-compiler]

    src/example/datepicker-value-example.html:28:53:
      28 │   <input matInput [matDatepicker]="picker4" [field]="form.date">
         ╵                                                      ~~~~~~~~~

  Error occurs in the template of component DatepickerValueExample.

    src/example/datepicker-value-example.ts:12:15:
      12 │   templateUrl: 'datepicker-value-example.html',
         ╵                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reproduction

StackBlitz link: https://stackblitz.com/edit/zzkeckx2?file=src%2Fexample%2Fdatepicker-value-example.ts,src%2Fexample%2Fdatepicker-value-example.html&startScript=start

Expected Behavior

No compile time error when using Datepicker with DateAdapter and [field] directive.

Actual Behavior

TS2322: Type 'Date' is not assignable to type 'string'.

Environment

  • Angular: 21.0.1
  • CDK/Material: 21.0.1
  • Browser(s):
  • Operating System (e.g. Windows, macOS, Ubuntu):

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageThis issue needs to be triaged by the team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions