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) {