Skip to content

Conversation

@Bima42
Copy link
Contributor

@Bima42 Bima42 commented Dec 26, 2025

What is this PR about?

Problem:
The TimeBadge component was always displaying UTC+00:00 regardless of the actual server timezone.

The client was calculating the offset by converting dates to strings using toLocaleString, then parsing those strings back into Date objects. When JavaScript parses a date string like "1/15/2025, 9:00:00 AM" with new Date(), it interprets it in the browser's local timezone, not the intended timezone. Both dates ended up in the same timezone, so the offset was always zero.

Fix:
I moved the offset calculation to the server side. The server now returns the offset along with the timezone and time. We use Intl.DateTimeFormat.

Extracted the offset calculation logic to utils/time.ts as getUtcOffset(timeZone) with comprehensive tests covering various timezones including edge cases like half-hour offsets (India UTC+05:30), invalid inputs, and the UTC special case.

Issues related (if applicable)

closes #3328

@Bima42 Bima42 requested a review from Siumauricio as a code owner December 26, 2025 12:33
@Siumauricio
Copy link
Contributor

I don't know what's wrong here? you need to setup the timezone here https://docs.dokploy.com/docs/core/manual-installation#setup-dokploy-timezone

Screenshot 2025-12-28 at 1 13 22 PM

@Bima42
Copy link
Contributor Author

Bima42 commented Dec 28, 2025

You're right, my bad for not checking the docs first. Closing this now, sorry for the noise!

@Bima42 Bima42 closed this Dec 28, 2025
@Bima42 Bima42 deleted the fix/time-badge-still-wrong branch December 28, 2025 22:27
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.

Server time is still wrong!

2 participants