Fix: Make end date inclusive for all activities (issues, commits, PRs) #27
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.
Problem
Activities created on the selected end date were not appearing in the analysis results. For example, issues posted on October 3rd would not appear unless October 4th was selected as the end date, making the date picker behavior unintuitive and inconsistent with user expectations.
Root Cause
While the frontend correctly sends the end date with time set to 23:59:59.999 to include the entire day, the backend was converting this to date-only strings (e.g.,
"2024-10-03") for GitHub GraphQL queries. GitHub's API interprets date-only strings as the start of that day (00:00:00), which excluded any activities created after midnight on the end date.Before this fix:
Solution
Add 1 day to the
untildate when constructing GitHub API queries. Since GitHub'suntilparameter and date comparisons are exclusive (or use start-of-day for date strings), adding 1 day makes the original end date fully inclusive.After this fix:
Changes
Modified
src/services/github.tswith minimal, surgical changes to three methods:getIssuesSince()- Added 1 day to theuntildate when creating the date-only ISO string for GraphQL search, and changed the search operator from<=to<fetchCommitsForDefaultBranch()- Added 1 day to theuntiltimestamp parametergetCommitCountsAcrossBranches()- Added 1 day to theuntiltimestamp parameterNote:
getPullRequestsSince()was already working correctly because it uses timestamp comparison which preserves the time component.Testing
Validated the fix with multiple scenarios:
Impact
This fix resolves the unintuitive behavior where users had to select the next day to see activities from their desired end date. The end date picker now works as expected, including all activities that occurred during the selected day.
Stats: 16 insertions(+), 4 deletions(-) in 1 file
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.