Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date picker doesn't remember date in calendar when only one date is picked #1572

Open
ArsalaanAnsariDeveloper opened this issue Dec 22, 2024 · 4 comments

Comments

@ArsalaanAnsariDeveloper

Describe the bug

When using the date picker component and selecting a single date, it does not remember the date when the calendar is opened again.

Reproduction

image

If you go to the https://next.shadcn-svelte.com/docs/components/date-picker page, input one date in the Date Range Picker component, close the component and then open it again, it will not select the date in the calendar.

Logs

No response

System Info

Chromium (Arc Browser)

Severity

annoyance

@ieedan
Copy link
Contributor

ieedan commented Dec 22, 2024

Also on Chromium Arc but I am unable to reproduce.

repro.mp4

@ArsalaanAnsariDeveloper
Copy link
Author

ArsalaanAnsariDeveloper commented Dec 22, 2024

Sorry, it should have been clearer; this only happens when one date is selected. In your video, you always select two dates. Here is a video on my end:

Screen.Recording.2024-12-22.at.11.27.34.AM.mov

@huntabyte
Copy link
Owner

huntabyte commented Dec 22, 2024

A range with a single date isn't a range, it's a single date. The value isn't committed until both a start and end date are selected.

In our demo, though, we could probably improve the UX by resetting it when closed without a start and end selected so that it isn't a confusing experience where only a single date is shown.

The startValue is provided as a way to enhance the user experience by populating part of the range before it is complete, so we just need to clear that when the user closes the picker if they select both it should be populated from the value.start.

@ArsalaanAnsariDeveloper
Copy link
Author

That's fair! I can see if I can put a PR up that mimics Bit UI's date range picker functionality shown in the video below. Also, I am curious why yall use a Popover + Range Calendar over the Bits UI Date Range Picker.

Screen.Recording.2024-12-22.at.1.24.12.PM.mov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants