Skip to content

Fix(UI): Synchronize campaign timeline with client real-time and display exact hours - #64

Open
Dedenwrg wants to merge 2 commits into
Alive24:mainfrom
Dedenwrg:main
Open

Fix(UI): Synchronize campaign timeline with client real-time and display exact hours#64
Dedenwrg wants to merge 2 commits into
Alive24:mainfrom
Dedenwrg:main

Conversation

@Dedenwrg

Copy link
Copy Markdown

This PR addresses an issue where the campaign submission form closes prematurely, and the progress bar jumps to 100% due to timezone/SSR mismatches.

Previously, the UI relied on a static new Date() evaluated during server-side rendering (SSR). This caused the timeline to freeze on the server's time/cache, leading to inaccurate submission rules and progress calculations for participants in different time zones.

Changes Made

  • Fixed Hydration Bug: Replaced the static const now = new Date() with a useState and useEffect hook. This ensures the current time is strictly synchronized in real-time with the participant's local device.
  • Improved Date Formatting: Replaced formatDateConsistent with a new formatExactTime helper for the Started and Ends displays. The UI now explicitly shows precise hours, minutes, and local timezone (e.g., Aug 27, 2026, 05:36 PM (Local Time)) to eliminate ambiguity.
  • Added Safety Check: Added a !now check to the loading state to ensure the UI gracefully waits for client hydration before rendering time-sensitive components.

Expected Behavior

  • The Ends and Started dates will now display the exact hour and minute.
  • The Campaign Progress bar will update live and accurately reflect the user's real local time.
  • The submission form will remain open strictly until the exact deadline is met on the user's local clock.

@netlify

netlify Bot commented Aug 27, 2026

Copy link
Copy Markdown

👷 Deploy request for ckboost pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 85ef635

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.

1 participant