-
-
Notifications
You must be signed in to change notification settings - Fork 432
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(datepicker) duplicate month display #1456 #1457
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThe changes enhance the Changes
Poem
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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 as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- packages/ui/src/components/Datepicker/Views/Months.tsx (3 hunks)
- packages/ui/src/components/Datepicker/helpers.ts (1 hunks)
Additional comments not posted (5)
packages/ui/src/components/Datepicker/Views/Months.tsx (4)
5-5
: LGTM! Import change aligns with new logic.The import statement now includes
isMonthEqual
instead ofisDateEqual
, which aligns with the new month-level comparison logic.
38-40
: LGTM! Initialization change avoids overflow issues.The
newDate
object is now initialized with the current date, the month set to the current index, and the day explicitly set to 1 to avoid overflow issues.
43-43
: LGTM! Month selection logic updated.The check for whether a month is selected now uses
isMonthEqual
instead ofisDateEqual
, aligning with the new month-level comparison logic.
Line range hint
44-55
:
LGTM! View date and view update logic.The
onClick
handler sets theviewDate
andview
if the month is not disabled, ensuring the correct update of the view date and view when a month is selected.packages/ui/src/components/Datepicker/helpers.ts (1)
47-49
: LGTM! New utility function for month comparison.The
isMonthEqual
function compares the month values of twoDate
objects, providing a straightforward way to compare month values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- packages/ui/src/components/Datepicker/Views/Months.tsx (2 hunks)
Additional comments not posted (4)
packages/ui/src/components/Datepicker/Views/Months.tsx (4)
5-5
: Import changes approved.The import of
isMonthEqual
aligns with the updated logic for month comparison, replacingisDateEqual
.
23-23
: Removal ofviewDate
from context values.The removal of
viewDate
from the destructured context values simplifies the component's state management.
30-32
: InitializenewDate
to avoid overflow issues.The initialization of
newDate
with the day set to 1 prevents overflow issues when setting the month.
35-35
: UseisMonthEqual
for month comparison.The use of
isMonthEqual
for checking if a month is selected aligns with the new month-level comparison logic.
Thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- packages/ui/src/components/Datepicker/Views/Months.tsx (2 hunks)
- packages/ui/src/components/Datepicker/helpers.ts (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- packages/ui/src/components/Datepicker/helpers.ts
Additional comments not posted (4)
packages/ui/src/components/Datepicker/Views/Months.tsx (4)
5-5
: Import statement updated correctly.The import of
isMonthEqual
aligns with the new month comparison logic.
30-32
: Setting day to 1 to avoid overflow issues is a good practice.The initialization of
newDate
with the day set to 1 helps prevent overflow issues when manipulating date values.
35-35
: Correct usage ofisMonthEqual
for month comparison.The use of
isMonthEqual
for checking if a month is selected aligns with the new focus on month comparison.
23-23
: Ensure the removal ofviewDate
does not affect functionality.The
viewDate
prop has been removed from the destructured context values. Verify that this change does not introduce any issues in other parts of the component or codebase.
Add isMonthEqual utility
Update Months.tsx to not clone viewDate and set date to 1 to avoid date overflow
Summary by CodeRabbit
viewDate
prop to streamline the component's state management.