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: "previous month" button appears when selecting a date #5214

Merged
merged 2 commits into from
Nov 9, 2024

Conversation

OlegDev1
Copy link
Contributor

@OlegDev1 OlegDev1 commented Nov 7, 2024

Description

Linked issue: #5193

Problem
Even though the min date is provided, when selecting the second month, "previous month" button still appears. It shouldn't happen, because the calendar from the screenshots starts at November.

Changes
Changed the calculation logic that determines whether previous month button should appear or not (borrowed some code from renderMonths, big thanks to @pmacmillan). Added a test case, in which a calendar is rendered with min date, after that the date from the second month is selected and it is expected for "previous month" button not to appear.

Screenshots

Calendar starts at November 7

Before
image
After
image

Contribution checklist

  • I have followed the contributing guidelines.
  • I have added sufficient test coverage for my changes.
  • I have formatted my code with Prettier and checked for linting issues with ESLint for code readability.

Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

✅ This pull request was sent to the PullRequest network for review. Expert reviewers are now being matched to your request based on the code's requirements. Stay tuned!

What to expect from this code review:
  • Comments posted to any areas of potential concern or improvement.
  • Detailed feedback or actions needed to resolve issues that are found.
  • Turnaround times vary, but we aim to be swift.

@OlegDev1 you can click here to see the review status or cancel the code review job.

Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

PullRequest Breakdown

Reviewable lines of change

+ 38
- 1

74% TSX (tests)
26% TSX

Type of change

Fix - These changes are likely to be fixing a bug or issue.

Copy link

codecov bot commented Nov 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.89%. Comparing base (826ba90) to head (7069485).
Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5214   +/-   ##
=======================================
  Coverage   96.88%   96.89%           
=======================================
  Files          29       29           
  Lines        3375     3381    +6     
  Branches     1409     1418    +9     
=======================================
+ Hits         3270     3276    +6     
+ Misses        105      103    -2     
- Partials        0        2    +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

This PR looks good to me; the only "issue" isn't a big deal.

Image of Jacob Jacob


Reviewed with ❤️ by PullRequest

src/test/calendar_test.test.tsx Outdated Show resolved Hide resolved
Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

No merge blocking issues found. I would suggest to test that the button also re-appears if/when appropriate. Other than that, changes look fine. Thanks for the PR.

Image of Frank T Frank T


Reviewed with ❤️ by PullRequest

@OlegDev1
Copy link
Contributor Author

OlegDev1 commented Nov 8, 2024

Thank you very much for the review, I really appreciate it!

I have added an additional button check in the test case as Frank suggested. I also replaced the non-null assertion with an error check

Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

Thank you very much for the review, I really appreciate it!

I have added an additional button check in the test case as Frank suggested. I also replaced the non-null assertion with an error check

👍

Image of Frank T Frank T

@martijnrusschen martijnrusschen merged commit bc84ae7 into Hacker0x01:main Nov 9, 2024
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

Successfully merging this pull request may close these issues.

2 participants