nextui-org / nextui

🚀 Beautiful, fast and modern React UI library.
https://nextui.org
MIT License
21.8k stars 1.49k forks source link

[BUG] - DatePicker When minValue is later than maxValue it crashes #3885

Open maxsynnott opened 1 week ago

maxsynnott commented 1 week ago

NextUI Version

2.4.8

Describe the bug

If you provide the DatePicker component with a minValue that is larger/later than maxValue it will crash with a React Too many re-renders error when trying to open the calendar

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

<DatePicker minValue={now("Etc/UTC").add({ days: 1 })} maxValue={now("Etc/UTC")} />

Expected behavior

The calendar will open with all days disabled

Screenshots or Videos

No response

Operating System Version

macOS

Browser

Chrome

linear[bot] commented 1 week ago

ENG-1456 [BUG] - DatePicker When minValue is later than maxValue it crashes

ShrinidhiUpadhyaya commented 1 week ago

@wingkwong Can i look into this?

ShrinidhiUpadhyaya commented 1 week ago

@wingkwong Can i look into this?

@wingkwong Quick question, what should be the expected behavior when minValue is greater than maxValue? Should we disable all dates or do we have to adjust the minValue so that it cannot exceed maxValue?

wingkwong commented 1 week ago

lemme get back to you later.

ryo-manba commented 4 days ago

This issue is a bug in React Aria. As a temporary fix, you could make the value controlled and implement the check before passing it.