Fix current day detection and duplicate day numbering bugs - #27
Open
shubamchaudhary wants to merge 1 commit into
Open
Fix current day detection and duplicate day numbering bugs#27shubamchaudhary wants to merge 1 commit into
shubamchaudhary wants to merge 1 commit into
Conversation
Bug Fixes:
1. Fixed wrong day selection (e.g., Day 2 highlighted instead of Day 3)
- Root cause: Timestamp comparison included time, causing off-by-one errors
- Solution: Normalize both today and startDate to midnight before comparison
- Applied fix in both useEffect (selectedDay) and render (isToday/isPast)
2. Fixed duplicate day numbers after Adjust Plan (Day 1, Day 1, Day 2...)
- Root cause: replanBasedOnProgress merged old days with new plan
- New plan's days were numbered 1, 2, 3... instead of continuing
- Solution: Renumber newPlan.dailyPlans to continue from daysPassed + 1
- Example: If daysPassed=2, new days become Day 3, Day 4, Day 5...
3. Updated plan title to be dynamic
- Changed "Your 40-Day Study Plan" to "Your {totalDays}-Day Study Plan"
- Now correctly shows "Your 30-Day Study Plan" for custom durations
Technical Details:
- setHours(0, 0, 0, 0) normalizes dates to midnight
- This ensures Day 3 is selected on the 3rd calendar day regardless of time
- Fixed in 3 places: useEffect, render calculation, replanBasedOnProgress
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug Fixes:
Fixed wrong day selection (e.g., Day 2 highlighted instead of Day 3)
Fixed duplicate day numbers after Adjust Plan (Day 1, Day 1, Day 2...)
Updated plan title to be dynamic
Technical Details: