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

feat: add month and year pickers to DateRangePicker and RangeCalendar #3302

Merged
merged 7 commits into from
Nov 4, 2024

Conversation

ryo-manba
Copy link
Member

@ryo-manba ryo-manba commented Jun 22, 2024

📝 Description

Added month and year pickers to DateRangePicker and RangeCalendar.

⛳️ Current behavior (updates)

DateRangePicker and RangeCalendar do not have month and year pickers.

🚀 New behavior

DateRangePicker and RangeCalendar now support month and year pickers.

💣 Is this a breaking change (Yes/No):

No.

📝 Additional Information

Summary by CodeRabbit

  • New Features

    • Added month and year picker functionality to DateRangePicker and RangeCalendar components.
  • Enhancements

    • Improved calendar components to include options for month and year selection.
    • Updated documentation to reflect new features, including the showMonthAndYearPickers prop and its interactions with visibleMonths.
  • Bug Fixes

    • Adjusted visibleMonths property to disable month and year pickers when set to a number greater than 1.
  • Documentation

    • Expanded documentation for Calendar, DatePicker, DateRangePicker, and RangeCalendar components to clarify new functionalities and prop behaviors.

Copy link

vercel bot commented Jun 22, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nextui-docs-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 4, 2024 6:34pm
nextui-storybook-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 4, 2024 6:34pm

Copy link

changeset-bot bot commented Jun 22, 2024

🦋 Changeset detected

Latest commit: 70a92fc

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

coderabbitai bot commented Jun 22, 2024

Warning

Rate limit exceeded

@jrgarciadev has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 21 minutes and 19 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between ca5c72b and 70a92fc.

Walkthrough

The recent update focuses on enhancing the DateRangePicker and RangeCalendar components by integrating month and year pickers. This addition offers users a faster way to select specific months and years. Several configuration properties were adjusted, added, or removed to support this feature across multiple components and documentation files, including updates to the @nextui-org package versions.

Changes

Files and Paths Change Summary
.../date-range-picker/index.ts, .../range-calendar/index.ts Added imports for month and year pickers and included them in exports.
.../date-range-picker/with-month-and-year-pickers.ts, .../range-calendar/... Introduced React components that utilize the new month and year picker features in DateRangePicker and RangeCalendar.
.../docs/components/... Updated documentation files to reflect the new feature, including changes to properties like visibleMonths and showMonthAndYearPickers.
.../calendar/src/use-calendar-base.ts, .../calendar/src/use-calendar.ts Added buttonPickerProps to UseCalendarBaseProps, and adjusted logic to simplify the determination for showing month and year pickers.
.../calendar/src/range-calendar.tsx Updated the Props interface by removing specific properties related to header expansion and month/year pickers.
.../calendar/src/use-range-calendar.ts Included buttonPickerProps and showMonthAndYearPickers parameters in the useRangeCalendar function.
.../calendar/stories/range-calendar.stories.tsx Removed deletion of showMonthAndYearPickers from calendar.defaultVariants and introduced a new export WithMonthAndYearPickers.
.../date-picker/stories/date-range-picker.stories.tsx Added a new export WithMonthAndYearPickers to showcase the month and year picker feature.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant DateRangePicker
    participant RangeCalendar
    participant CalendarHeader
    participant CalendarBase

    User->>DateRangePicker: Render with showMonthAndYearPickers
    DateRangePicker->>RangeCalendar: Initialize component
    RangeCalendar->>CalendarHeader: Show picker button
    CalendarHeader->>CalendarBase: Handle button press
    CalendarBase-->>CalendarHeader: Render month and year pickers
    CalendarHeader-->>RangeCalendar: Show updated view
    RangeCalendar-->>User: Display with month and year pickers
Loading

Assessment against linked issues

Objective (Issue) Addressed Explanation
showMonthAndYearPickers prop is not working in Range Calendar Component (#3089)
Year picker for rapid selection in Date Range Picker Component (#3090)

Possibly related PRs

Suggested labels

👀 Status: In Review, 📋 Scope : Docs

Suggested reviewers

  • wingkwong

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@jrgarciadev
Copy link
Member

@ryo-manba please adjust the range calendar docs and make clear that it only works when visible months is 1, add examples as well to range-calendar and date-range-picker docs

@ryo-manba
Copy link
Member Author

@jrgarciadev
Sorry for the delay. I have updated the documentaton!

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Outside diff range and nitpick comments (3)
packages/components/calendar/src/use-calendar.ts (1)

Line range hint 27-29: Consider renaming buttonPickerProps for clarity.

The parameter buttonPickerProps might be more descriptive if renamed to monthYearPickerButtonProps to clearly indicate its purpose.

-  buttonPickerProps: buttonPickerPropsProp,
+  monthYearPickerButtonProps: buttonPickerPropsProp,
packages/components/calendar/stories/range-calendar.stories.tsx (1)

Line range hint 273-273: Avoid using the comma operator.

The comma operator is disallowed as it often obscures side effects. Refactor the code to avoid using the comma operator.

-  setValue(nextMonthValue), setFocusedValue(nextMonthValue.start);
+  setValue(nextMonthValue);
+  setFocusedValue(nextMonthValue.start);
apps/docs/content/docs/components/date-picker.mdx (1)

Line range hint 324-325: Correct preposition usage for clarity.

Use "on" instead of "in" for better clarity.

- | Element to be rendered in the left side of the date-picker.
+ | Element to be rendered on the left side of the date-picker.
- | Element to be rendered in the right side of the date-picker.
+ | Element to be rendered on the right side of the date-picker.
Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 9daef56 and ca5c72b.

Files selected for processing (16)
  • .changeset/kind-cobras-travel.md (1 hunks)
  • apps/docs/content/components/date-range-picker/index.ts (2 hunks)
  • apps/docs/content/components/date-range-picker/with-month-and-year-pickers.ts (1 hunks)
  • apps/docs/content/components/range-calendar/index.ts (2 hunks)
  • apps/docs/content/components/range-calendar/with-month-and-year-picker.ts (1 hunks)
  • apps/docs/content/docs/components/calendar.mdx (2 hunks)
  • apps/docs/content/docs/components/date-picker.mdx (3 hunks)
  • apps/docs/content/docs/components/date-range-picker.mdx (3 hunks)
  • apps/docs/content/docs/components/range-calendar.mdx (2 hunks)
  • packages/components/calendar/src/calendar-header.tsx (1 hunks)
  • packages/components/calendar/src/range-calendar.tsx (1 hunks)
  • packages/components/calendar/src/use-calendar-base.ts (2 hunks)
  • packages/components/calendar/src/use-calendar.ts (1 hunks)
  • packages/components/calendar/src/use-range-calendar.ts (6 hunks)
  • packages/components/calendar/stories/range-calendar.stories.tsx (2 hunks)
  • packages/components/date-picker/stories/date-range-picker.stories.tsx (1 hunks)
Files skipped from review due to trivial changes (2)
  • .changeset/kind-cobras-travel.md
  • packages/components/calendar/src/calendar-header.tsx
Additional context used
Biome
packages/components/calendar/stories/range-calendar.stories.tsx

[error] 273-273: The comma operator is disallowed.

Its use is often confusing and obscures side effects.

(lint/style/noCommaOperator)

packages/components/date-picker/stories/date-range-picker.stories.tsx

[error] 488-488: Alternative text title element cannot be empty

For accessibility purposes, SVGs should have an alternative text, provided via title element. If the svg element has role="img", you should add the aria-label or aria-labelledby attribute.

(lint/a11y/noSvgWithoutTitle)

LanguageTool
apps/docs/content/docs/components/date-picker.mdx

[style] ~109-~109: ‘taken into account’ might be wordy. Consider a shorter alternative.
Context: ...ncerns such as daylight saving time are taken into account when the value is manipulated. [@Inter...

(EN_WORDINESS_PREMIUM_TAKEN_INTO_ACCOUNT)


[typographical] ~226-~226: Usually, there’s no comma before “if”.
Context: ...lows displaying up to 3 months at a time, if screen space permits. <CodeDemo title=...

(IF_NO_COMMA)


[grammar] ~324-~324: In this case, the usual preposition with “side” is “on”, not “in”. Did you mean “on the left side”?
Context: ... | Element to be rendered in the left side of the date-picker. ...

(IN_ON_THE_RIGHT_HAND_SIDE)


[grammar] ~325-~325: In this case, the usual preposition with “side” is “on”, not “in”. Did you mean “on the right side”?
Context: ... | Element to be rendered in the right side of the date-picker. ...

(IN_ON_THE_RIGHT_HAND_SIDE)


[typographical] ~332-~332: Consider adding a comma after ‘Usually’ for more clarity.
Context: ...icon to toggle the date picker popover. Usually a calendar icon. ...

(RB_LY_COMMA)


[grammar] ~338-~338: When ‘24-hour’ is used as a modifier, it is usually spelled with a hyphen.
Context: ... | Whether to display the time in 12 or 24 hour format. This is determined by the user'...

(HOUR_HYPHEN)


[uncategorized] ~339-~339: A comma may be missing after the conjunctive/linking adverb ‘Typically’.
Context: ...t that is displayed in the date picker. Typically "day" for dates. ...

(SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA)

apps/docs/content/docs/components/calendar.mdx

[style] ~90-~90: Consider using a different verb for a more formal wording.
Context: ...ssage slot may be used to help the user fix the issue. By default, the selected da...

(FIX_RESOLVE)


[uncategorized] ~214-~214: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...r, e.g. single letter, abbreviation, or full day name. ...

(EN_COMPOUND_ADJECTIVE_INTERNAL)

apps/docs/content/docs/components/range-calendar.mdx

[style] ~98-~98: Consider using a different verb for a more formal wording.
Context: ...ssage slot may be used to help the user fix the issue. By default, the selected da...

(FIX_RESOLVE)


[uncategorized] ~222-~222: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...r, e.g. single letter, abbreviation, or full day name. ...

(EN_COMPOUND_ADJECTIVE_INTERNAL)

apps/docs/content/docs/components/date-range-picker.mdx

[typographical] ~65-~65: Usually, there’s no comma before “if”.
Context: ...lows displaying up to 3 months at a time, if screen space permits. <CodeDemo title=...

(IF_NO_COMMA)


[style] ~126-~126: ‘taken into account’ might be wordy. Consider a shorter alternative.
Context: ...ncerns such as daylight saving time are taken into account when the value is manipulated. [@Inter...

(EN_WORDINESS_PREMIUM_TAKEN_INTO_ACCOUNT)


[grammar] ~241-~241: This expression is usually spelled with a hyphen.
Context: ...PickerContent.unavailableDates} /> ### Non Contiguous The allowsNonContiguousRanges prop ena...

(NON_ANTI_JJ)


[misspelling] ~338-~338: Use “an” instead of ‘a’ if the following word starts with a vowel sound, e.g. ‘an article’, ‘an hour’.
Context: ...ent**: When the date-range-picker has a end content. Base on those endContent...

(EN_A_VS_AN)


[style] ~340-~340: This phrasing could be wordy, so try replacing it with something more concise.
Context: ... the date-range-picker's visibleMonth is more than 2. ## Accessibility ...

(MORE_THAN_EXCEEDS)


[grammar] ~373-~373: In this case, the usual preposition with “side” is “on”, not “in”. Did you mean “on the left side”?
Context: ... | Element to be rendered in the left side of the date-range-picker. ...

(IN_ON_THE_RIGHT_HAND_SIDE)


[grammar] ~374-~374: In this case, the usual preposition with “side” is “on”, not “in”. Did you mean “on the right side”?
Context: ... | Element to be rendered in the right side of the date-range-picker. ...

(IN_ON_THE_RIGHT_HAND_SIDE)


[typographical] ~384-~384: Consider adding a comma after ‘Usually’ for more clarity.
Context: ...icon to toggle the date picker popover. Usually a calendar icon. ...

(RB_LY_COMMA)


[grammar] ~388-~388: When ‘24-hour’ is used as a modifier, it is usually spelled with a hyphen.
Context: ... | Whether to display the time in 12 or 24 hour format. This is determined by the user'...

(HOUR_HYPHEN)


[uncategorized] ~389-~389: A comma may be missing after the conjunctive/linking adverb ‘Typically’.
Context: ...t that is displayed in the date picker. Typically "day" for dates. ...

(SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA)

Additional comments not posted (16)
apps/docs/content/components/range-calendar/with-month-and-year-picker.ts (1)

1-10: LGTM!

The with-month-and-year-picker component correctly integrates the RangeCalendar with the month and year picker functionality.

apps/docs/content/components/date-range-picker/with-month-and-year-pickers.ts (1)

1-13: LGTM!

The with-month-and-year-pickers component correctly integrates the DateRangePicker with the month and year picker functionality.

apps/docs/content/components/range-calendar/index.ts (1)

Line range hint 15-32: LGTM!

The withMonthAndYearPicker import and export are correctly added to the range-calendar content.

packages/components/calendar/src/range-calendar.tsx (1)

13-13: LGTM!

The Props interface has been streamlined by removing unnecessary properties, simplifying the RangeCalendar component.

apps/docs/content/components/date-range-picker/index.ts (1)

22-22: LGTM!

However, ensure that the with-month-and-year-pickers module exists and is correctly implemented.

Also applies to: 47-47

Verification successful

LGTM!

The with-month-and-year-pickers module exists and is correctly implemented in the date-range-picker directory.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the existence of the `with-month-and-year-pickers` module.

# Test: Check if the file exists. Expect: The file should exist.
fd --type f 'with-month-and-year-pickers.ts'

Length of output: 194

packages/components/calendar/src/use-calendar.ts (1)

16-16: Ensure type consistency for UseCalendarProps.

The new type UseCalendarProps correctly extends UseCalendarBaseProps and AriaCalendarProps. Make sure this change is consistent with other related types and interfaces.

Verification successful

Type consistency for UseCalendarProps verified.

The UseCalendarProps type is consistently defined and used across the codebase. The useCalendar function is correctly updated and used in multiple places without any inconsistencies.

  • UseCalendarProps is correctly imported and extended in calendar.tsx.
  • UseCalendarBaseProps and AriaCalendarProps are correctly defined and used.
  • The useCalendar function is correctly implemented and used across the codebase.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify type consistency for `UseCalendarProps`.

# Test: Search for the usage of `UseCalendarProps`. Expect: Consistent usage across the codebase.
rg --type ts 'UseCalendarProps'

Length of output: 507



Script:

#!/bin/bash
# Search for the definitions of `UseCalendarBaseProps` and `AriaCalendarProps`
rg --type ts 'UseCalendarBaseProps'
rg --type ts 'AriaCalendarProps'

# Verify the `useCalendar` function implementation and its usage
rg --type ts 'useCalendar'

Length of output: 5675

packages/components/calendar/src/use-range-calendar.ts (2)

11-12: Ensure correct import of ButtonProps.

The import of ButtonProps from @nextui-org/button is necessary for the new buttonPickerProps parameter. Make sure this import is correct and used consistently.

Verification successful

Verified correct import and usage of ButtonProps.

The import of ButtonProps from @nextui-org/button is consistent and correctly used across the codebase, including the use-range-calendar file.

  • packages/components/calendar/src/use-range-calendar.ts: Correct import and usage of ButtonProps.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the correct import of `ButtonProps`.

# Test: Search for the usage of `ButtonProps`. Expect: Consistent usage across the codebase.
rg --type ts 'ButtonProps'

Length of output: 23442


47-47: Ensure correct implementation of showMonthAndYearPickers.

The new showMonthAndYearPickers parameter is introduced. Make sure this parameter is correctly implemented and used throughout the component.

Verification successful

The showMonthAndYearPickers parameter is correctly implemented and used throughout the component.

The parameter is consistently defined, assigned, and utilized in relevant contexts across multiple files:

  • packages/components/date-picker/src/use-date-picker-base.ts
  • packages/components/calendar/src/use-calendar.ts
  • packages/components/calendar/src/use-calendar-base.ts
  • packages/components/calendar/src/use-range-calendar.ts
  • packages/components/calendar/src/calendar-header.tsx
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the correct implementation of `showMonthAndYearPickers`.

# Test: Search for the usage of `showMonthAndYearPickers`. Expect: Consistent usage across the codebase.
rg --type ts 'showMonthAndYearPickers'

Length of output: 4635



Script:

#!/bin/bash
# Inspect the usage of `showMonthAndYearPickers` in key files to ensure correct implementation.

# Extract relevant lines from files where `showMonthAndYearPickers` is defined or used.
rg --type ts --type tsx --line-number --context 5 'showMonthAndYearPickers' packages/components/date-picker/src/use-date-picker-base.ts packages/components/calendar/src/use-calendar.ts packages/components/calendar/src/use-calendar-base.ts packages/components/calendar/src/use-range-calendar.ts packages/components/calendar/src/calendar-header.tsx

Length of output: 374



Script:

#!/bin/bash
# Inspect the usage of `showMonthAndYearPickers` in key files to ensure correct implementation.

# Extract relevant lines from files where `showMonthAndYearPickers` is defined or used.
rg --type-add 'tsx:*.tsx' --type ts --type tsx --line-number --context 5 'showMonthAndYearPickers' packages/components/date-picker/src/use-date-picker-base.ts packages/components/calendar/src/use-calendar.ts packages/components/calendar/src/use-calendar-base.ts packages/components/calendar/src/use-range-calendar.ts packages/components/calendar/src/calendar-header.tsx

Length of output: 18789

packages/components/calendar/stories/range-calendar.stories.tsx (1)

379-385: LGTM!

The new export WithMonthAndYearPickers correctly demonstrates the new feature.

packages/components/calendar/src/use-calendar-base.ts (2)

166-171: Add documentation for buttonPickerProps.

The buttonPickerProps property has been added, but it lacks detailed documentation.

+  /**
+   * Props for the button picker, which is used to select the month, year and expand the header.
+   */

Likely invalid or redundant comment.


222-224: Ensure showMonthAndYearPickers logic is correct.

The logic for showMonthAndYearPickers is clear and correctly implemented. However, ensure that this logic aligns with the rest of the codebase.

Verification successful

Ensure showMonthAndYearPickers logic is correct.

The logic for showMonthAndYearPickers aligns with the rest of the codebase. It is consistently used in various contexts, such as stories, tests, and source files, and the condition visibleMonths === 1 is correctly implemented.

  • packages/components/calendar/src/use-calendar-base.ts: const showMonthAndYearPickers = originalProps.showMonthAndYearPickers && visibleMonths === 1;
  • Other instances in stories and tests also reflect the correct usage.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the usage of `showMonthAndYearPickers` in the codebase.

# Test: Search for the usage of `showMonthAndYearPickers`. Expect: Consistent logic and usage.
rg --type typescript $'showMonthAndYearPickers'

Length of output: 81



Script:

#!/bin/bash
# Description: Verify the usage of `showMonthAndYearPickers` in the codebase.

# Test: Search for the usage of `showMonthAndYearPickers`. Expect: Consistent logic and usage.
rg --type ts 'showMonthAndYearPickers'

Length of output: 4635

packages/components/date-picker/stories/date-range-picker.stories.tsx (1)

386-392: Add alternative text for SVGs for accessibility.

Ensure all SVGs have alternative text for accessibility purposes.

- <svg height="1em" viewBox="0 0 24 24" width="1em">
+ <svg height="1em" viewBox="0 0 24 24" width="1em" aria-label="Calendar icon">

Likely invalid or redundant comment.

apps/docs/content/docs/components/range-calendar.mdx (2)

110-114: LGTM!

The documentation for the showMonthAndYearPickers prop is clear and concise.


217-223: LGTM!

The documentation for the showMonthAndYearPickers prop in the props table is clear and concise.

Tools
LanguageTool

[uncategorized] ~222-~222: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...r, e.g. single letter, abbreviation, or full day name. ...

(EN_COMPOUND_ADJECTIVE_INTERNAL)

apps/docs/content/docs/components/date-range-picker.mdx (2)

99-103: LGTM!

The documentation for the showMonthAndYearPickers prop is clear and concise.


386-396: LGTM!

The documentation for the showMonthAndYearPickers prop in the props table is clear and concise.

Tools
LanguageTool

[grammar] ~388-~388: When ‘24-hour’ is used as a modifier, it is usually spelled with a hyphen.
Context: ... | Whether to display the time in 12 or 24 hour format. This is determined by the user'...

(HOUR_HYPHEN)


[uncategorized] ~389-~389: A comma may be missing after the conjunctive/linking adverb ‘Typically’.
Context: ...t that is displayed in the date picker. Typically "day" for dates. ...

(SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA)

Comment on lines +86 to +87
You can show month and year pickers in the calendar popover by setting the `showMonthAndYearPickers` property to `true`. However, passing a number greater than 1 to the `visibleMonths` prop will disable this feature.

Copy link
Contributor

Choose a reason for hiding this comment

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

Improve wording for clarity.

The sentence can be improved for better clarity.

- You can show month and year pickers in the calendar popover by setting the `showMonthAndYearPickers` property to `true`. However, passing a number greater than 1 to the `visibleMonths` prop will disable this feature.
+ To enable month and year pickers in the calendar popover, set the `showMonthAndYearPickers` property to `true`. Note that setting the `visibleMonths` prop to a number greater than 1 will disable this feature.
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
You can show month and year pickers in the calendar popover by setting the `showMonthAndYearPickers` property to `true`. However, passing a number greater than 1 to the `visibleMonths` prop will disable this feature.
You can show month and year pickers in the calendar popover by setting the `showMonthAndYearPickers` property to `true`. Note that setting the `visibleMonths` prop to a number greater than 1 will disable this feature.

@@ -101,7 +101,7 @@ This example validates that the selected date is a weekday and not a weekend acc

### With Month And Year Picker

Calendar supports month and year picker for rapid selection.
Calendar supports month and year picker for rapid selection. You can enable this feature by setting `showMonthAndYearPickers` to `true`. However, if `visibleMonths` is set to a number greater than 1, this feature will be disabled.
Copy link
Contributor

Choose a reason for hiding this comment

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

Improve clarity in documentation.

The sentence can be improved for better clarity.

- Calendar supports month and year picker for rapid selection. You can enable this feature by setting `showMonthAndYearPickers` to `true`. However, if `visibleMonths` is set to a number greater than 1, this feature will be disabled.
+ The calendar supports month and year pickers for rapid selection. Enable this feature by setting `showMonthAndYearPickers` to `true`. Note that if `visibleMonths` is set to a number greater than 1, this feature will be disabled.
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Calendar supports month and year picker for rapid selection. You can enable this feature by setting `showMonthAndYearPickers` to `true`. However, if `visibleMonths` is set to a number greater than 1, this feature will be disabled.
Calendar supports month and year picker for rapid selection. You can enable this feature by setting `showMonthAndYearPickers` to `true`. However, if `visibleMonths` is set to a number greater than 1, this feature will be disabled.
```
```suggestion
The calendar supports month and year pickers for rapid selection. Enable this feature by setting `showMonthAndYearPickers` to `true`. Note that if `visibleMonths` is set to a number greater than 1, this feature will be disabled.

Comment on lines +79 to +82
const buttonPickerProps: ButtonProps = {
...buttonPickerPropsProp,
onPress: chain(buttonPickerPropsProp?.onPress, () => setIsHeaderExpanded(!isHeaderExpanded)),
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider renaming buttonPickerProps for clarity.

The parameter buttonPickerProps might be more descriptive if renamed to monthYearPickerButtonProps to clearly indicate its purpose.

-  const buttonPickerProps: ButtonProps = {
-    ...buttonPickerPropsProp,
-    onPress: chain(buttonPickerPropsProp?.onPress, () => setIsHeaderExpanded(!isHeaderExpanded)),
-  };
+  const monthYearPickerButtonProps: ButtonProps = {
+    ...buttonPickerPropsProp,
+    onPress: chain(buttonPickerPropsProp?.onPress, () => setIsHeaderExpanded(!isHeaderExpanded)),
+  };
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const buttonPickerProps: ButtonProps = {
...buttonPickerPropsProp,
onPress: chain(buttonPickerPropsProp?.onPress, () => setIsHeaderExpanded(!isHeaderExpanded)),
};
const monthYearPickerButtonProps: ButtonProps = {
...buttonPickerPropsProp,
onPress: chain(buttonPickerPropsProp?.onPress, () => setIsHeaderExpanded(!isHeaderExpanded)),
};

@Artem2001S
Copy link

@ryo-manba
when is the pull request scheduled to be closed ?

@wingkwong
Copy link
Member

@Artem2001S This PR is marked in 2.5.0 milestone. We'll merge this after v2.4.3.

.changeset/kind-cobras-travel.md Outdated Show resolved Hide resolved
@jrgarciadev jrgarciadev merged commit a4a1d8f into canary Nov 4, 2024
4 of 6 checks passed
@jrgarciadev jrgarciadev deleted the feat/month-year-pickers branch November 4, 2024 18:27
ryo-manba added a commit that referenced this pull request Nov 6, 2024
…#3302)

* feat: add month and year pickers to DateRangePicker and RangeCalendar

* chore: update docs

* Update .changeset/kind-cobras-travel.md

* chore: react package version

---------

Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants