Skip to content

fix: replace hardcoded program deadlines with dynamic computation (#999)#1414

Merged
Sachinchaurasiya360 merged 1 commit into
Sachinchaurasiya360:mainfrom
Xenon010101:fix/program-tracker-hardcoded-dates
Jun 5, 2026
Merged

fix: replace hardcoded program deadlines with dynamic computation (#999)#1414
Sachinchaurasiya360 merged 1 commit into
Sachinchaurasiya360:mainfrom
Xenon010101:fix/program-tracker-hardcoded-dates

Conversation

@Xenon010101
Copy link
Copy Markdown
Contributor

Closes #999

@github-actions github-actions Bot added bug Something isn't working gssoc labels Jun 4, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 4, 2026

Warning

Review limit reached

@Xenon010101, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 15 minutes and 20 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b1b8f34d-5247-418e-90ae-aa51f2e2bb3e

📥 Commits

Reviewing files that changed from the base of the PR and between e15a36c and 2c66802.

📒 Files selected for processing (1)
  • client/src/module/student/opensource/ProgramTrackerPage.tsx
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added gssoc:approved Approved for GSSoC scoring level:beginner Good for first-time contributors labels Jun 4, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 4, 2026

Hi @Xenon010101, thanks for contributing to InternHack! 🎉

I have automatically:

  • 👤 Assigned this PR to you.
  • 🏷️ Applied the gssoc:approved label.

Our workflows will now analyze your changes to classify:

  • 📈 PR Difficulty: level:*
  • 🧩 PR Type: type:*
  • 🌟 PR Quality: quality:*

Tip

Ensure your PR description references the issue it resolves (e.g. Closes #123). This allows the bot to inherit any additional labels from that issue!

Happy coding! 🚀

@github-actions github-actions Bot added scope:frontend Changes to client-side / UI code quality:clean Clean and well-structured contribution type:bug Bug fixes labels Jun 4, 2026
@Sachinchaurasiya360
Copy link
Copy Markdown
Owner

Code Review — PR #1414: Replace hardcoded program deadlines with dynamic computation

Hi @Xenon010101, replacing hardcoded ISO strings with dynamic computation is the right call. Found one logic bug and a merge conflict to flag.


🔴 nextDate() computed at module load — deadlines go stale after midnight

// Module-level constant — evaluated ONCE when the file is first imported
const PROGRAMS: Program[] = [
  {
    applicationDeadline: nextDate(4, 19),  // new Date() is called here at startup
  },
  ...
];

nextDate calls new Date() inside, but PROGRAMS is a static array initialized when the module loads. If the user's tab stays open across midnight when a deadline rolls over, or across the year boundary when d.setUTCFullYear(d.getUTCFullYear() + 1) would trigger, the computed string is frozen at startup time.

For a program tracker, a 24-hour stale deadline could show "1 day left" as "2 days left" or "Closed" as "1 day left".

Fix: Move deadline computation into the component or a useMemo:

function ProgramCard({ program }: { program: Program }) {
  const urgency = useMemo(() => getUrgency(program), [program]);
  ...
}

Or define PROGRAMS as a function that returns a fresh array each call, and memoize at the component level.


🟡 Merge conflict chain: PRs #1414, #1415, #1416, #1417 all touch ProgramTrackerPage.tsx

These four PRs need to be merged in sequence. Rebase this PR on top of whichever others merge first, otherwise the merge will conflict.

@Sachinchaurasiya360 Sachinchaurasiya360 merged commit 2c66802 into Sachinchaurasiya360:main Jun 5, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working gssoc:approved Approved for GSSoC scoring gssoc level:beginner Good for first-time contributors quality:clean Clean and well-structured contribution scope:frontend Changes to client-side / UI code type:bug Bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: ProgramTrackerPage has hardcoded outdated deadlines — shows past dates as future

2 participants