Skip to content

Mahitha taking over: complete server date protection for timelog and weekly summary#5390

Open
Mahitha-pasupuleti wants to merge 1 commit into
developmentfrom
MahithaPasupuleti--ResolvedServerDateIssue-Frontend
Open

Mahitha taking over: complete server date protection for timelog and weekly summary#5390
Mahitha-pasupuleti wants to merge 1 commit into
developmentfrom
MahithaPasupuleti--ResolvedServerDateIssue-Frontend

Conversation

@Mahitha-pasupuleti

@Mahitha-pasupuleti Mahitha-pasupuleti commented Jul 15, 2026

Copy link
Copy Markdown

Description

Implements: #4312 (Priority: High)
Screenshot 2026-07-15 at 2 49 20 PM

This PR resolves the issue where users could bypass time entry validation by changing their local system date. Previously, the frontend relied on the client's local time, allowing users to log time for incorrect dates by modifying their device clock.

This implementation updates the frontend to fetch the current server time before creating a time entry. Time entry validation now uses the server date instead of the local system date, preventing users from logging time on dates other than the current server date.

Related Issue


Related PRs

  • Frontend PR: This PR
  • Backend PR: PR #2271

To test this feature, check out both the frontend and backend PRs.


Main changes explained

  • Added a new serverTime utility to retrieve the current backend server time.
  • Updated postTimeEntry() to fetch the latest server time before submitting a time entry.
  • Replaced local system date validation with server-based date validation.
  • Prevented users from logging time for any date other than the current server date.
  • Displayed an error message when attempting to log time for a different day.

How to test

  1. Check out both the frontend and backend branches.

  2. Run:

    npm install
    npm start
  3. Clear the browser cache/site data.

  4. Log in as an admin user.

  5. Navigate to Dashboard → Tasks → Select a task → Log Time.

  6. Verify that logging time for the current server date succeeds.

  7. Change your computer's system date to a previous or future day.

  8. Attempt to log time again.

  9. Verify that:

    • The application displays "You can only log time for today."
    • No time entry is created.
  10. Reset your system clock and verify that logging time for the current date works as expected.


Screenshots or Videos

Video demonstration:
https://youtu.be/ziEJpHzcmX8


Note

This PR depends on the corresponding backend PR, which introduces the /api/servertime endpoint used for server-based date validation.

@netlify

netlify Bot commented Jul 15, 2026

Copy link
Copy Markdown

Deploy Preview for highestgoodnetwork-dev ready!

Name Link
🔨 Latest commit aec8500
🔍 Latest deploy log https://app.netlify.com/projects/highestgoodnetwork-dev/deploys/6a57e4794b6bed0008e39f0e
😎 Deploy Preview https://deploy-preview-5390--highestgoodnetwork-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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.

1 participant