-
-
Notifications
You must be signed in to change notification settings - Fork 757
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
Updated the calender to not accomodate future dates #2865
Updated the calender to not accomodate future dates #2865
Conversation
WalkthroughThe pull request modifies the Changes
Assessment against linked issues
Possibly related PRs
Suggested reviewers
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 using PR comments)
Other keywords and placeholders
Documentation and Community
|
Our Pull Request Approval ProcessThanks for contributing! Testing Your CodeRemember, your PRs won't be reviewed until these criteria are met:
Our policies make our code better. ReviewersDo not assign reviewers. Our Queue Monitors will review your PR and assign them.
Reviewing Your CodeYour reviewer(s) will have the following roles:
CONTRIBUTING.mdRead our CONTRIBUTING.md file. Most importantly:
Other
|
This is an upgrade on PR #2848 Please have a look if all the requirements are matched. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop-postgres #2865 +/- ##
=====================================================
+ Coverage 63.58% 88.13% +24.55%
=====================================================
Files 296 316 +20
Lines 7371 8271 +900
Branches 1610 1868 +258
=====================================================
+ Hits 4687 7290 +2603
+ Misses 2451 770 -1681
+ Partials 233 211 -22 ☔ View full report in Codecov by Sentry. |
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.
Please add a test for this. We don't want the error to happen again.
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
🧹 Nitpick comments (1)
src/screens/UserPortal/Settings/Settings.spec.tsx (1)
413-443
: Great addition to ensure future dates are disallowed!
This test successfully validates that the user cannot input a future date. As a minor enhancement, consider adding an additional test for near-future boundaries (e.g., tomorrow) to solidify confidence across different environments and time zones.
Sure i will make relevant changes in the Settings.spec.tsx |
Please have look into the added tests, let me know if any further changes are required |
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.
See comments
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
🧹 Nitpick comments (1)
src/screens/UserPortal/Settings/Settings.spec.tsx (1)
414-445
: LGTM! Consider adding more edge casesThe test case effectively validates the birth date restrictions using dynamic date calculations. Good job on testing both the rejection of future dates and acceptance of current date.
Consider enhancing the test coverage with additional edge cases:
- Tomorrow's date (immediate future)
- Yesterday's date (immediate past)
- Date at midnight UTC to handle timezone edge cases
Example enhancement:
// Add these test scenarios after line 444 const tomorrow = new Date(); tomorrow.setDate(tomorrow.getDate() + 1); const tomorrowString = tomorrow.toISOString().split('T')[0]; // Should reject tomorrow's date fireEvent.change(birthDateInput, { target: { value: tomorrowString } }); expect(birthDateInput.value).not.toBe(tomorrowString); const yesterday = new Date(); yesterday.setDate(yesterday.getDate() - 1); const yesterdayString = yesterday.toISOString().split('T')[0]; // Should accept yesterday's date fireEvent.change(birthDateInput, { target: { value: yesterdayString } }); expect(birthDateInput.value).toBe(yesterdayString);
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/screens/UserPortal/Settings/Settings.spec.tsx
(1 hunks)
🔇 Additional comments (1)
src/screens/UserPortal/Settings/Settings.spec.tsx (1)
Line range hint 26-26
: Replace hardcoded dates with dynamically calculated ones
The mock data contains hardcoded dates ('2024-03-01') that will become past dates after March 2024. Replace these with dynamically calculated dates to ensure the tests remain valid over time.
Example fix:
- birthDate: '2024-03-01',
+ birthDate: new Date().toISOString().split('T')[0],
Also applies to: 63-63, 244-244
Please have a look, and let me know if any further changes are required. |
74305b0
into
PalisadoesFoundation:develop-postgres
What kind of change does this PR introduce?
It restricts the user from selecting a future date as their date of birth from the calendar.
Issue Number:
Fixes #2732
Did you add tests for your changes?
Yes
Snapshots/Videos:
Have you read the contributing guide?
Yes
Summary by CodeRabbit
Summary by CodeRabbit
New Features
Bug Fixes
Tests