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

fix(date-picker): open calendar on min enabled month when current month is after max date #472

Merged
merged 5 commits into from
Feb 15, 2024

Conversation

samrichardsontylertech
Copy link
Contributor

@samrichardsontylertech samrichardsontylertech commented Feb 14, 2024

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added/updated: Y
  • Docs have been added/updated: N
  • Does this PR introduce a breaking change? N
  • I have linked any related GitHub issues to be closed when this PR is merged? Y

Describe the new behavior?

This adjusts the <forge-date-picker> to open its calendar to the month of the min date when these conditions are met:

  • A min date is set
  • A max date is set
  • The max date occurs before the current month

Otherwise if the current date falls outside the min and/or max dates the calendar opens on the month with the closest enabled dates, which was the previous behavior in all cases.

This also, and more importantly, fixes an issue where the calendar would incorrectly determine that its displayed month and year fall outside of the min or max date and unexpectedly go to the min or max date instead of the current one.

Additional information

The previous behavior was determined to be confusing when all enabled dates occur before the current month. Other possible solutions discussed included leaving the behavior as-is or allowing the month and year the calendar opens on to be manually set on the date-picker.

Closes #450

@samrichardsontylertech samrichardsontylertech added the skip-release Preserve the current version when merged label Feb 14, 2024
@samrichardsontylertech samrichardsontylertech requested a review from a team as a code owner February 14, 2024 20:41
Copy link

stackblitz bot commented Feb 14, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@DRiFTy17 DRiFTy17 added the patch Increment the patch version when merged label Feb 15, 2024
@DRiFTy17 DRiFTy17 removed the skip-release Preserve the current version when merged label Feb 15, 2024
@DRiFTy17 DRiFTy17 merged commit baa24e7 into main Feb 15, 2024
7 checks passed
@DRiFTy17 DRiFTy17 deleted the fix/date-picker-initial-month branch February 15, 2024 19:03
@github-actions github-actions bot added the released This issue/pull request has been released. label Feb 15, 2024
Copy link
Contributor

🚀 PR was released in v3.0.0-next.20 🚀

@github-actions github-actions bot added the prerelease This change relates to a prerelease. label Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch Increment the patch version when merged prerelease This change relates to a prerelease. released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Date Picker Default Initial Month
2 participants