Thanks to visit codestin.com
Credit goes to github.com

Skip to content

bug(matTimePicker): dateFnsAdapter incorrectly parse hours #31837

@alixroyere

Description

@alixroyere

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

When typing hour, time picker selects 0h option when typing hour > 9h.
There is a time parsing issue with dateFnsAdapter.

Reproduction

StackBlitz link: https://stackblitz.com/edit/bmbh8m2b-gpqc3u8f?file=src%2Fexample%2Ftimepicker-locale-example.ts
Steps to reproduce:

  1. Wait a bit for app to load, as it is super slow. (Try to use chrome instead of firefox if it never loads 🥲 ).
  2. App is ready when the input is displayed.
  3. Type any 1-digit => it works
  4. Type 10, or anything up to 23 => it selects 0 (??)

Expected Behavior

Type 10, or anything up to 23 => it selects matching option.
We should be able to customize hour parser with MatDateFormats, as for dates.

Actual Behavior

Type 10, or anything up to 23 => it selects 0h option.
We are not able to customize hour parser with MatDateFormats: only typing 0 to 9 hours, or typing full hours and minutes (HH:mm) work.

Environment

  • Angular: 20.2.4 (same behavior on 19)
  • CDK/Material: 20.2.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/timepicker

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions