From 21befd5b1e8f02de46b8a87b67a1075ee46e05a6 Mon Sep 17 00:00:00 2001 From: "soroush.asadi" Date: Sat, 20 Jun 2026 17:16:57 +0330 Subject: [PATCH] Display timestamps in Tehran time, not UTC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The server clock is correct (UTC); the app rendered UTC wall-clock directly, so the run log showed ~3.5h behind Tehran. Add JalaliDate.ToTehran (flat UTC+3:30 — Iran dropped DST in 2022) + DateTimeLabel, and convert the UTC-stored timestamp displays (ingestion run log, RawListing FetchedAt, report CreatedAt). Shift start/end inputs are TimeOnly, left as-is. Co-Authored-By: Claude Opus 4.8 --- src/JobsMedical.Web/Pages/Admin/Index.cshtml | 2 +- src/JobsMedical.Web/Pages/Admin/Ingested.cshtml | 2 +- src/JobsMedical.Web/Pages/Admin/Reports.cshtml | 2 +- .../Pages/Shared/_RawListingRow.cshtml | 2 +- src/JobsMedical.Web/Services/JalaliDate.cs | 12 ++++++++++++ 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/JobsMedical.Web/Pages/Admin/Index.cshtml b/src/JobsMedical.Web/Pages/Admin/Index.cshtml index f79d58e..f31663f 100644 --- a/src/JobsMedical.Web/Pages/Admin/Index.cshtml +++ b/src/JobsMedical.Web/Pages/Admin/Index.cshtml @@ -102,7 +102,7 @@ @foreach (var run in Model.Runs) { - @JalaliDate.ToLongDate(DateOnly.FromDateTime(run.RunAt)) @run.RunAt.ToString("HH:mm") + @JalaliDate.DateTimeLabel(run.RunAt) @JalaliDate.ToPersianDigits(run.Fetched.ToString()) @JalaliDate.ToPersianDigits(run.Queued.ToString()) @JalaliDate.ToPersianDigits(run.Published.ToString()) diff --git a/src/JobsMedical.Web/Pages/Admin/Ingested.cshtml b/src/JobsMedical.Web/Pages/Admin/Ingested.cshtml index d57c7b6..627419a 100644 --- a/src/JobsMedical.Web/Pages/Admin/Ingested.cshtml +++ b/src/JobsMedical.Web/Pages/Admin/Ingested.cshtml @@ -91,7 +91,7 @@ @label اطمینان @P(r.Confidence)٪ - @JalaliDate.ToLongDate(DateOnly.FromDateTime(r.FetchedAt)) — @JalaliDate.ToPersianDigits(r.FetchedAt.ToString("HH:mm")) + @JalaliDate.DateTimeLabel(r.FetchedAt)

@(r.RawText.Length > 320 ? r.RawText.Substring(0,320) + "…" : r.RawText)

diff --git a/src/JobsMedical.Web/Pages/Admin/Reports.cshtml b/src/JobsMedical.Web/Pages/Admin/Reports.cshtml index 69ef91c..490090a 100644 --- a/src/JobsMedical.Web/Pages/Admin/Reports.cshtml +++ b/src/JobsMedical.Web/Pages/Admin/Reports.cshtml @@ -35,7 +35,7 @@ @StatusLabel(r.Status)

«@r.Reason»

-
@JalaliDate.ToLongDate(DateOnly.FromDateTime(r.CreatedAt)) · گزارش‌دهنده: @(r.ReporterUserId is not null ? "کاربر #" + r.ReporterUserId : "مهمان")
+
@JalaliDate.ToLongDate(DateOnly.FromDateTime(JalaliDate.ToTehran(r.CreatedAt))) · گزارش‌دهنده: @(r.ReporterUserId is not null ? "کاربر #" + r.ReporterUserId : "مهمان")
مشاهده مورد @if (r.Status == ReportStatus.Open) diff --git a/src/JobsMedical.Web/Pages/Shared/_RawListingRow.cshtml b/src/JobsMedical.Web/Pages/Shared/_RawListingRow.cshtml index d230f3a..1aaab5a 100644 --- a/src/JobsMedical.Web/Pages/Shared/_RawListingRow.cshtml +++ b/src/JobsMedical.Web/Pages/Shared/_RawListingRow.cshtml @@ -8,7 +8,7 @@ @Model.SourceChannel اطمینان @JalaliDate.ToPersianDigits(c.ToString())٪ - @JalaliDate.ToLongDate(DateOnly.FromDateTime(Model.FetchedAt)) — @JalaliDate.ToPersianDigits(Model.FetchedAt.ToString("HH:mm")) + @JalaliDate.DateTimeLabel(Model.FetchedAt)

@Model.RawText

diff --git a/src/JobsMedical.Web/Services/JalaliDate.cs b/src/JobsMedical.Web/Services/JalaliDate.cs index 562610e..adbff1a 100644 --- a/src/JobsMedical.Web/Services/JalaliDate.cs +++ b/src/JobsMedical.Web/Services/JalaliDate.cs @@ -25,6 +25,18 @@ public static class JalaliDate private static readonly char[] PersianDigits = { '۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹' }; + /// Convert a UTC timestamp (we store everything as DateTime.UtcNow) to Tehran + /// wall-clock. Iran is a fixed UTC+3:30 (DST abolished in 2022), so a flat offset is exact and + /// needs no timezone database. + public static DateTime ToTehran(DateTime utc) => utc.AddMinutes(210); + + /// Jalali date + Tehran time, e.g. «۳۰ خرداد ۱۴۰۵ ۱۶:۲۱» — for UTC-stored timestamps. + public static string DateTimeLabel(DateTime utc) + { + var t = ToTehran(utc); + return ToLongDate(DateOnly.FromDateTime(t)) + " " + ToPersianDigits(t.ToString("HH:mm")); + } + /// Convert Latin digits in a string to Persian digits. public static string ToPersianDigits(string input) {