Skip to content

Fix timezone/DST-unsafe deadline and countdown rendering #10

Closed

Description

@chonilius

Problem

Bounty.deadline and the derived countdown/urgency UI (likely on BountyCard.tsx and the bounty detail page, given Difficulty/status badges exist) render an ISO deadline string. Nothing in src/lib/utils.ts (per the README's description "currency/percent/date formatting") is confirmed to handle timezones correctly. Deadlines for on-chain escrow release are inherently a "wall clock across timezones" problem: a contributor in UTC+13 and a maintainer in UTC-8 need to see the same absolute deadline moment, but a naive new Date(deadline).toLocaleDateString() without explicit timezone/locale handling can render different calendar dates for each of them, and worse, if any part of the codebase does manual date-string parsing/arithmetic (e.g. new Date(deadline).getDate() - new Date().getDate() style day-difference math) rather than using proper duration libraries or UTC-safe arithmetic, deadline countdowns can be off by one near DST transitions or month boundaries.

Why this is hard

  • Requires actually reading every date-handling function in src/lib/utils.ts and every call site that renders deadline, createdAt-equivalents, or countdowns (bounty cards, bounty detail escrow status, milestone pages) to find naive arithmetic — this is a cross-cutting audit, not a single function fix.
  • No date library appears in package.json (no date-fns, dayjs, luxon) — you need to decide whether to add a minimal dependency (weigh bundle size for a Next.js edge-rendered app) or write careful native Intl/UTC-safe helpers, and justify the choice.
  • "Time remaining" countdowns that update client-side (if any exist, e.g. a live "expires in 2h 14m" ticking display) need to handle the server-rendered initial value vs. client re-render consistently to avoid hydration mismatches — a naive Date.now() call during SSR vs. hydration will produce a mismatch warning or a jumping countdown.
  • Must define and apply one consistent policy: display deadlines in the viewer's local timezone with the actual instant preserved (correct), not in a hardcoded UTC or server-timezone format that reads as "wrong" to non-UTC users.

Scope

  • Audit all date rendering/arithmetic in src/lib/utils.ts and its call sites for timezone-naive or DST-unsafe logic.
  • Introduce a small, justified date-handling dependency or a well-tested native Intl-based helper set.
  • Fix all countdown/deadline displays to use viewer-local rendering of an absolute instant, consistently.
  • Fix any hydration-mismatch risk in live-updating countdown components.
  • Add unit tests around DST transition dates and month/year boundaries.

Acceptance criteria

  • A fixed deadline instant renders the correct relative "time remaining" and correct calendar date regardless of the viewing browser's timezone, verified with at least three simulated timezones (UTC, UTC+13, UTC-8).
  • No hydration mismatch warnings from any countdown component.

Activity

  1. added
    very hard
    bug
    help wanted
    on Jul 15, 2026
  2. added
    GrantFox OSS
    Maybe Rewarded
    Official Campaign | FWC26
    on Jul 15, 2026
  3. added
    Stellar Wave
    on Aug 25, 2026
  4. Joseph-1-Duro commented on Aug 25, 2026

    @Joseph-1-Duro

    @Joseph-1-Duro has applied to work on this issue as part of the Stellar Wave Program's 8th wave.

    Hi, I would like to tackle this issue

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @Joseph-1-Duro to this issue.

  5. oldtaker24 commented on Aug 25, 2026

    @oldtaker24
    Contributor

    @oldtaker24 has applied to work on this issue as part of the Stellar Wave Program's 8th wave.

    i will like to work on this issues

    ℹ️ Repo Maintainers: To accept this application, review their application or assign @oldtaker24 to this issue.

  6. drips-wave commented on Aug 25, 2026

    @drips-wave

    Congratulations, @oldtaker24! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on August 31, 2026.

    🧑‍💻 @oldtaker24: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.

    Warning

    When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.

    🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.

    🌊 Happy Wave 🌊

  7. grantfox-oss commented on Aug 25, 2026

    @grantfox-oss

    🎉 This issue has been marked as completed on GrantFox as part of the Third Campaign campaign!

    @oldtaker24's PR #336 was approved and merged by @chonilius.

    🏆 @oldtaker24: You earned 35 FoxPoints for this contribution! Your current tier: Explorer (48 total points). Track your full progress on GrantFox.

    👏 Great work, @oldtaker24! Keep contributing to MergeFi.

  8. drips-wave commented on Aug 25, 2026

    @drips-wave

    This issue has been completed by @oldtaker24 as part of the Stellar Wave Program's 8th Wave 🥳

    😎 @oldtaker24: You earned 200 Points for completing this issue! After the current Wave ends, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.

    🧑‍💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.

  9. removed
    Stellar Wave
    on Oct 15, 2026
  10. added
    Stellar Wave
    on Oct 15, 2026
  11. removed
    Stellar Wave
    on Oct 15, 2026
  12. added
    Stellar Wave
    on Oct 15, 2026
  13. removed
    Stellar Wave
    on Oct 15, 2026
  14. added
    Stellar Wave
    on Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

GrantFox OSSMaybe RewardedOfficial Campaign | FWC26Stellar Wavebughelp wantedvery hard

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions