Skip to content

DateInput, TimeInput, and DateTimeInput are inconsistent #9623

Open

Description

What you were expecting:

These inputs should receive Date or string and publish Date.

What happened instead:

They are inconsistent:

  • DateInput receives string and returns string,
  • TimeInput receives string | Date and returns Date
  • DateTimeInput receives string | Date and returns Date

Steps to reproduce:

Make a form with a DateTimeInput, change your mind after talking with the UX team and then switch to DateInput. Now the published value switched from a Date object to a string and validation and transformation functions may unexpectedly break.

Other information:

The DateInput does actually receive a Date or a string, but the documentation says it receives a string.

The parse field for DateTimeInput and TimeInput defaults to a date parser that produces a date object. For the DateInput, the parse field is empty by default.

Environment

  • React-admin version: 4.16.7
  • Last version that did not exhibit the issue (if applicable): n/a
  • React version: n/a
  • Browser: n/Z
  • Stack trace (in case of a JS error): n/a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions