Skip to content

bug: useDatePicker sometimes limits day of month to 30 #3256

@jordanoverbye

Description

@jordanoverbye

🐛 Bug Report

This bug can be reproduced using the interactive demos on the useDatePicker documentation page.

When I first interact with the component I'm unable to enter any dates which have 31 as the day of the month. When I type in 31, my text is cleared and the value is set to 01.

🤔 Expected Behavior

A user should be able to enter dates that have 31 as the day of the month, for example 31st Jan 2022.

😯 Current Behavior

  1. Focus into the day segment
  2. Type in 31
  3. Day segment shows 01
  4. Enter in a month and day to get a valid date
  5. Change day of month from 01 to 31

💁 Possible Solution

  • Looks like something in useDateFieldState is the issue, but haven't had time to investigate.
  • Looks like aria-valuemax="30" is set when the component is first rendered, but after some user interaction it gets set to aria-valuemax="31"

🔦 Context

💻 Code Sample

You can also see this issue in the "styled" code sandbox examples of useDatePicker.

🌍 Your Environment

Software Version(s)
react-spectrum "@react-aria/datepicker": "3.0.0"
Browser Chrome
Operating System Mac

Full list of dependencies can be found in the package.json https://codesandbox.io/s/reverent-faraday-5nwk87?file=/package.json

🧢 Your Company/Team

N/A

🕷 Tracking Issue (optional)

N/A

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    📋 Waiting for Sprint

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions