Skip to content

refactor: standardize UTC date handling across backend - #174

Merged
Tybravo merged 1 commit into
SwiftChainn:mainfrom
starboytiimz:refactor/standardize-utc-timezone
Aug 31, 2026
Merged

refactor: standardize UTC date handling across backend#174
Tybravo merged 1 commit into
SwiftChainn:mainfrom
starboytiimz:refactor/standardize-utc-timezone

Conversation

@starboytiimz

Copy link
Copy Markdown
Contributor

Closes #153

Summary

Standardizes date/time handling across the backend to UTC, fixing one genuine timezone-boundary bug and consolidating date construction behind shared utils for consistency.

Changes

  • src/utils/dateUtils.ts (new) — nowUTC(), toUTC(), toISOUTC() helpers
  • src/models/DriverProfile.ts (modified) — vehicle year validation used new Date().getFullYear(), which reads the server's local time and could misvalidate near a UTC day/year boundary depending on server locale. Now uses nowUTC().getUTCFullYear().
  • src/services/escrowService.ts, src/services/idempotency.service.ts, src/sockets/sync.service.ts, src/sockets/location.service.ts (modified) — replaced direct new Date()/new Date(x) calls with nowUTC()/toUTC() for consistency. Note: these were already timezone-safe (no local-time accessor methods were in use), so this is a non-behavioral consistency change, not a bug fix.

Audit

Searched the full src/ tree for local-timezone-dependent accessor usage (getFullYear, getHours, getDate, getDay, getMonth, toLocaleDateString, toLocaleString) outside the files above. No further instances found.

Architecture

  • Pure refactor, no new endpoints, no schema changes
  • No new dependencies added

Security / Rollback

  • No new attack surface, date handling only
  • Rollback: revert this branch's commits; MongoDB already stores Date as UTC internally, no data migration involved.

@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

@starboytiimz Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@starboytiimz

Copy link
Copy Markdown
Contributor Author

@Tybravo please approve workflow for the two pr's created. Thanks

@Tybravo
Tybravo merged commit 0ef413b into SwiftChainn:main Aug 31, 2026
1 check failed
@Tybravo

Tybravo commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

@starboytiimz
Thanks for contributing

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.

[Enhancement] Standardize all timezone handling across the backend to strictly use UTC

2 participants