Skip to content

Conversation

@ShivaGupta-14
Copy link
Contributor

@ShivaGupta-14 ShivaGupta-14 commented Dec 28, 2025

Description

  • Add parseTaskwarriorDate utility for Taskwarrior date format (YYYYMMDDTHHMMSSZ)

  • Fix weekly report to use start of week instead of last 7 days

  • Use end date for completed tasks instead of modified date

  • Use entry date as fallback for pending tasks without due date

  • Add count labels on chart bars for better visibility

  • Refactor isOverdue to use shared date parsing utility

  • Fixes: Bug: Reports charts always show 0 and weekly range is incorrect #322

Checklist

  • Ran npx prettier --write . (for formatting)
  • Ran gofmt -w . (for Go backend)
  • Ran npm test (for JS/TS testing)
  • Added unit tests, if applicable
  • Verified all tests pass
  • Updated documentation, if needed

Additional Notes

Video:

Screen.Recording.2025-12-28.at.11.35.29.AM.mov

@github-actions
Copy link

Thank you for opening this PR!

Before a maintainer takes a look, it would be really helpful if you could walk through your changes using GitHub's review tools.

Please take a moment to:

  • Check the "Files changed" tab
  • Leave comments on any lines for functions, comments, etc. that are important, non-obvious, or may need attention
  • Clarify decisions you made or areas you might be unsure about and/or any future updates being considered.
  • Finally, submit all the comments!

More information on how to conduct a self review:
https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/reviewing-proposed-changes-in-a-pull-request

This helps make the review process smoother and gives us a clearer understanding of your thought process.

Once you've added your self-review, we'll continue from our side. Thank you!

…tractor#322)

- Add parseTaskwarriorDate utility for Taskwarrior date format (YYYYMMDDTHHMMSSZ)
- Fix weekly report to use start of week instead of last 7 days
- Use end date for completed tasks instead of modified date
- Use entry date as fallback for pending tasks without due date
- Add count labels on chart bars for better visibility
- Refactor isOverdue to use shared date parsing utility

Fixes: CCExtractor#322
@ShivaGupta-14 ShivaGupta-14 force-pushed the fix/322-reports-chart-bug branch from 660ff59 to e0922de Compare December 28, 2025 06:15
Copy link
Contributor Author

Choose a reason for hiding this comment

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

centralized Taskwarrior date parsing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

refactored isOverdue to use the shared parseTaskwarriorDate utility

import { ReportsViewProps } from '../../utils/types';
import { getStartOfDay } from '../../utils/utils';
import { ReportChart } from './ReportChart';
import { parseTaskwarriorDate } from '../Tasks/tasks-utils';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

using shared parseTaskwarriorDate utility

return tasks
.filter((task) => {
const taskDateStr = task.modified || task.due;
const taskDateStr = task.end || task.due || task.entry;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

completed tasks now use end date for filtering and entry as fallback for pending tasks without a due date

const sevenDaysAgo = getStartOfDay(new Date());
sevenDaysAgo.setDate(sevenDaysAgo.getDate() - 7);
const weeklyData = [{ name: 'This Week', ...countStatuses(sevenDaysAgo) }];
const weeklyData = [{ name: 'This Week', ...countStatuses(startOfWeek) }];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed weekly report to use startOfWeek, now this ensures "This Week" actually represents the current calendar week, not just the last 7 days

Copy link
Contributor Author

Choose a reason for hiding this comment

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

show values above bars and removed cursor highlight effect (for better UX)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added tests for parseTaskwarriorDate function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated dates, test names, and fallbacks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated mock task data to use valid dates

Copy link
Contributor Author

@ShivaGupta-14 ShivaGupta-14 left a comment

Choose a reason for hiding this comment

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

self review completed! ready for review

</span>
<span>
ongoing: 1
ongoing: 0
Copy link
Collaborator

Choose a reason for hiding this comment

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

these should be reverted, as they are opposing the test rules

</span>
<span>
ongoing: 4
ongoing: 0
Copy link
Collaborator

Choose a reason for hiding this comment

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

several should've been > 0 as well, as it was before


if (!dateString) return null;

const parsed = dateString.replace(
Copy link
Collaborator

Choose a reason for hiding this comment

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

regex is mostly hard to read or maintain, shall switch to normal subString methods in js

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.

Bug: Reports charts always show 0 and weekly range is incorrect

2 participants