From 6b44526acb2c08eb4625fd0e844a541ae0c8eee6 Mon Sep 17 00:00:00 2001 From: fgsfds <4870330+fgsfds@users.noreply.github.com> Date: Sat, 8 Nov 2025 13:34:17 +0500 Subject: [PATCH] fixed timezone in xray logs --- web/html/index.html | 4 +++- web/service/server.go | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/web/html/index.html b/web/html/index.html index 84445fbf..1c6bb0be 100644 --- a/web/html/index.html +++ b/web/html/index.html @@ -844,9 +844,11 @@ text = `${log.Email}`; } + const { locale, timeZone } = Intl.DateTimeFormat().resolvedOptions(); + formattedLogs += ` - ${new Date(log.DateTime).toLocaleString()} + ${new Date(log.DateTime).toLocaleString(locale, { timeZone })} ${log.FromAddress} ${log.ToAddress} ${log.Inbound} diff --git a/web/service/server.go b/web/service/server.go index b7cfc3a7..2526a058 100644 --- a/web/service/server.go +++ b/web/service/server.go @@ -794,11 +794,11 @@ func (s *ServerService) GetXrayLogs( for i, part := range parts { if i == 0 { - dateTime, err := time.Parse("2006/01/02 15:04:05.999999", parts[0]+" "+parts[1]) + dateTime, err := time.ParseInLocation("2006/01/02 15:04:05.999999", parts[0]+" "+parts[1], time.Local) if err != nil { continue } - entry.DateTime = dateTime + entry.DateTime = dateTime.UTC() } if part == "from" {