WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@ddudenin
Copy link
Contributor

@ddudenin ddudenin commented Nov 14, 2025

Plan

  • Implement the date range selection in a well-typed format.
  • Multi-month view: supports displaying some consecutive months side-by-side.
  • Add DatePicker variants (like Calendar).
  • Support marking certain dates as unavailable.
  • Pass tests.
    • Compilation.
    • Check, clippy tests.
    • Doc comments.
    • Playwright.
    • Add components.

Fixes #132

  - Add DatePicker variants
  - Draft implementation DateRange for DatePicker
  - Extend DateRange struct
  - Use min and max dates in props as DateRange
  - Spell check fix for Calendar
  - Fix date range selection
  - Support disabled ranges
@ddudenin ddudenin marked this pull request as ready for review December 6, 2025 09:22
@github-actions
Copy link

github-actions bot commented Dec 6, 2025

@ddudenin
Copy link
Contributor Author

ddudenin commented Dec 6, 2025

@ealmloff Finally ready to give my brainchild for review

@ealmloff ealmloff added enhancement New feature or request primitives labels Dec 8, 2025
Copy link
Member

@ealmloff ealmloff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this! I noticed a few bugs with the styling and logic of the calendar. We need some more playwright test (and potentially some inline tests) to verify the behavior of the new multi-calendar view and hopefully catch issues like this in the future.

There are two issues with the styling:

  1. The alignment between the days of the week and the calendar grid is off
  2. The heading is a bit cluttered. We can support the more complex dropdown month/year, but the simple variant would look nicer in the demo. We also only need the month change buttons on the outside of calendar group instead of between each calendar

This PR:
Screenshot 2025-12-08 at 9 14 13 AM

ShadCN:
Screenshot 2025-12-08 at 9 10 22 AM

/// DatePickerCalendar {
/// selected_date: selected_date(),
/// on_date_change: move |date| selected_date.set(date),
/// calendar: Calendar,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the change in this example required to make the example compile? We should have a default calendar and still allow you to pass in a selected_date and on_date_change callback

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the Date picker and Calendar are linked, the logic is designed so that passing params selected_date and on_date_change to the date picker component will automatically reassign them to the Calendar.

Or is there a need to allow the user to set these properties separately for the Calendar?

In fact, on_date_change method for the Calendar is where these components synchronize their data.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought this was the regular calendar. Not accepting selected date separately is good for the DatePickerCalendar, but it would still be nice to have a default calendar

@ddudenin ddudenin force-pushed the main branch 2 times, most recently from a81221e to ecbd1ce Compare December 9, 2025 13:30
@ddudenin
Copy link
Contributor Author

ddudenin commented Dec 9, 2025

@ealmloff I've fixed the style errors and various logical inaccuracies you mentioned above.
Except for one, but I have a small question for you.

And I have a question about the Calendar test error in Playwright.
I downloaded the extension in VS Code and all the tests pass. I'd like to fix it in PR. What could be the error?

image

  - Fix docs
  - Add alignment between the days of the week and the Calendar grid
  - Add simple title variant in Calendar demo
  - Add css for Calendar title
  - Update time crate version (support PartialOrd for Month)
  - Fix view day on next/previous button click
  - Fix DateRangePickerContext (sync data)
  - Fix arrow navigation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request primitives

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Date range in Date Picker

2 participants