Skip to content

Yu Yan taking over: complete server date protection for timelog and weekly summary#5129

Open
yany960 wants to merge 2 commits intodevelopmentfrom
codex/yuyan-pr4312-server-date
Open

Yu Yan taking over: complete server date protection for timelog and weekly summary#5129
yany960 wants to merge 2 commits intodevelopmentfrom
codex/yuyan-pr4312-server-date

Conversation

@yany960
Copy link
Copy Markdown
Contributor

@yany960 yany960 commented Apr 10, 2026

Description

This PR takes over and replaces the abandoned work from PR #4312 to fully protect timelog and weekly summary flows from local/system date manipulation.

Related PRs

Main changes explained

  • Added ServerTimeContext to centralize authoritative server-date access and periodic re-sync logic.
  • Wrapped the app in ServerTimeProvider so time-sensitive flows can use the same server-based date source.
  • Added GET_SERVER_DATE frontend endpoint wiring for the related backend API.
  • Updated TimeEntryForm to initialize and refresh dateOfWork from server time instead of the local machine clock.
  • Updated TimeEntry same-day checks to use server time rather than local time.
  • Updated Timelog week boundary calculations and date labels to use server time.
  • Updated WeeklySummary due-date initialization and week-belonging checks so the dashboard due date no longer follows modified local/system time.
  • Updated affected unit tests to render through ServerTimeProvider.

Why this replaces PR #4312

Review feedback on #4312 showed that changing the computer date/time could still:

  • Shift the weekly summary due date on the dashboard
  • Change the default date used in time entry flows
  • Allow users to log time into the wrong week

This replacement PR keeps the original server-date approach but closes the remaining gaps where local moment() usage was still leaking into weekly summary and timelog behavior.

How to test

  1. Check out codex/yuyan-pr4312-server-date.
  2. Run the related backend from PR Shiwani old badges unit test #1875.
  3. Start the frontend locally.
  4. Change your computer date/time to a different week or month.
  5. Verify the time-entry date still reflects server time.
  6. Verify the weekly summary due date still reflects server time.
  7. Verify the behavior in both light mode and dark mode.

@netlify
Copy link
Copy Markdown

netlify bot commented Apr 10, 2026

Deploy Preview for highestgoodnetwork-dev ready!

Name Link
🔨 Latest commit 3f76387
🔍 Latest deploy log https://app.netlify.com/projects/highestgoodnetwork-dev/deploys/69d85fc7201e360008dd5292
😎 Deploy Preview https://deploy-preview-5129--highestgoodnetwork-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@sonarqubecloud
Copy link
Copy Markdown

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.

2 participants