Display timestamps in Tehran time, not UTC
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 <noreply@anthropic.com>
This commit is contained in:
@@ -102,7 +102,7 @@
|
||||
@foreach (var run in Model.Runs)
|
||||
{
|
||||
<tr style="border-top:1px solid var(--line);" title="@run.Detail">
|
||||
<td style="padding:6px 8px;">@JalaliDate.ToLongDate(DateOnly.FromDateTime(run.RunAt)) @run.RunAt.ToString("HH:mm")</td>
|
||||
<td style="padding:6px 8px;">@JalaliDate.DateTimeLabel(run.RunAt)</td>
|
||||
<td style="padding:6px 8px;">@JalaliDate.ToPersianDigits(run.Fetched.ToString())</td>
|
||||
<td style="padding:6px 8px;">@JalaliDate.ToPersianDigits(run.Queued.ToString())</td>
|
||||
<td style="padding:6px 8px; color:var(--primary-dark); font-weight:700;">@JalaliDate.ToPersianDigits(run.Published.ToString())</td>
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
<span style="display:flex; gap:6px; align-items:center;">
|
||||
<span class="badge @cls">@label</span>
|
||||
<span class="badge badge-type">اطمینان @P(r.Confidence)٪</span>
|
||||
<span class="muted" style="font-size:12px;">@JalaliDate.ToLongDate(DateOnly.FromDateTime(r.FetchedAt)) — @JalaliDate.ToPersianDigits(r.FetchedAt.ToString("HH:mm"))</span>
|
||||
<span class="muted" style="font-size:12px;">@JalaliDate.DateTimeLabel(r.FetchedAt)</span>
|
||||
</span>
|
||||
</div>
|
||||
<p style="margin:8px 0; white-space:pre-wrap; font-size:13.5px;">@(r.RawText.Length > 320 ? r.RawText.Substring(0,320) + "…" : r.RawText)</p>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
<span class="badge @(r.Status == ReportStatus.Open ? "badge-day" : "badge-type")">@StatusLabel(r.Status)</span>
|
||||
</div>
|
||||
<p style="margin:8px 0;">«@r.Reason»</p>
|
||||
<div class="muted" style="font-size:12px;">@JalaliDate.ToLongDate(DateOnly.FromDateTime(r.CreatedAt)) · گزارشدهنده: @(r.ReporterUserId is not null ? "کاربر #" + r.ReporterUserId : "مهمان")</div>
|
||||
<div class="muted" style="font-size:12px;">@JalaliDate.ToLongDate(DateOnly.FromDateTime(JalaliDate.ToTehran(r.CreatedAt))) · گزارشدهنده: @(r.ReporterUserId is not null ? "کاربر #" + r.ReporterUserId : "مهمان")</div>
|
||||
<div style="display:flex; gap:8px; margin-top:10px;">
|
||||
<a class="btn btn-outline" style="padding:6px 12px;" href="@JobsMedical.Web.Pages.Admin.ReportsModel.TargetUrl(r)" target="_blank">مشاهده مورد</a>
|
||||
@if (r.Status == ReportStatus.Open)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<strong>@Model.SourceChannel</strong>
|
||||
<span style="display:flex; gap:8px; align-items:center;">
|
||||
<span class="badge @confClass">اطمینان @JalaliDate.ToPersianDigits(c.ToString())٪</span>
|
||||
<span class="muted" style="font-size:12px;">@JalaliDate.ToLongDate(DateOnly.FromDateTime(Model.FetchedAt)) — @JalaliDate.ToPersianDigits(Model.FetchedAt.ToString("HH:mm"))</span>
|
||||
<span class="muted" style="font-size:12px;">@JalaliDate.DateTimeLabel(Model.FetchedAt)</span>
|
||||
</span>
|
||||
</div>
|
||||
<p style="margin:10px 0; white-space:pre-wrap;">@Model.RawText</p>
|
||||
|
||||
@@ -25,6 +25,18 @@ public static class JalaliDate
|
||||
|
||||
private static readonly char[] PersianDigits = { '۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹' };
|
||||
|
||||
/// <summary>Convert a UTC timestamp (we store everything as <c>DateTime.UtcNow</c>) 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.</summary>
|
||||
public static DateTime ToTehran(DateTime utc) => utc.AddMinutes(210);
|
||||
|
||||
/// <summary>Jalali date + Tehran time, e.g. «۳۰ خرداد ۱۴۰۵ ۱۶:۲۱» — for UTC-stored timestamps.</summary>
|
||||
public static string DateTimeLabel(DateTime utc)
|
||||
{
|
||||
var t = ToTehran(utc);
|
||||
return ToLongDate(DateOnly.FromDateTime(t)) + " " + ToPersianDigits(t.ToString("HH:mm"));
|
||||
}
|
||||
|
||||
/// <summary>Convert Latin digits in a string to Persian digits.</summary>
|
||||
public static string ToPersianDigits(string input)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user