Skip to content

Selecting a selected date for a calendar using DateTime has a different behaviour to a Date. #4750

@FredsW47

Description

@FredsW47

🐛 Bug Report

When selecting a date using useDatePicker, selecting the already selected date hides the calendar, however this behaviour is different for a DateTime. When selecting the selected date with DateTime this does not hide the calendar. Therefore no interaction is recorded.

The affect: When using a placeholder date in the calendar (for example highlighting todays date when the user first opens the calendar) means the user can not select that date and therefore the text field will not update.

Case One:

Screen.Recording.2023-07-06.at.10.38.15.mov

Case Two:

Screen.Recording.2023-07-06.at.10.35.38.mov

🤔 Expected Behavior

The behaviour when using a DateTime should be the same as when using a Date.

  • The calendar closes if a user selects the selected date when using DateTime.

😯 Current Behavior

The behaviour can be seen on the React Aria documentation.

When selecting the selected date for the example date, the calendar closes (Example)
When selecting the selected date for Timezones, the calendar does not close. (Example)

🔦 Context

  • Having two different behaviours for the user is not ideal.
  • When using a placeholder date in the calendar (for example highlighting todays date when the user first opens the calendar) means the user can not select that date and therefore the text field will not update.

We have implemented both calendars within our environment and we see the same behaviour occur.

💻 Code Sample

The behaviour can be seen on the React Aria documentation.

Can use the code sandbox in the documentation: ((Date), (DateTime))

🌍 Your Environment

Issue occurs using your code sandbox,

Our Environment:

  • React Vite - 4.0.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    📋 Waiting for Sprint

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions