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

using startMonth and endMonth can make captionLayout="dropdown" unusable #2549

Open
SudoCat opened this issue Oct 17, 2024 · 0 comments
Open

Comments

@SudoCat
Copy link

SudoCat commented Oct 17, 2024

When using captionLayout="dropdown", months and years outside of the range are disabled. This prevents the user from using the dropdowns to select a valid month and year, if the currently selected month or year does not exist in the target month or year.

Code

import { DayPicker } from "react-day-picker";

export function Start() {
  const from = new Date("2024-10-01");
  const to = new Date("2025-02-01");
  return (
    <DayPicker startMonth={from} endMonth={to} captionLayout="dropdown"  />
  );
}

Expected Behavior

I should be able to select a date in the following year using only the dropdowns.

Ideally, if I select "2025" while in "November 2024", it should automatically change the month accordingly.

Actual Behavior

It is impossible to select a different year if the current month is not available in that year.

Screenshots

Screen Recording 2024-10-17 at 17 43 34

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

1 participant