Quellcode durchsuchen

使用日本时区 Asia/Tokyo

ChenYu vor 6 Monaten
Ursprung
Commit
0b62a2498b
1 geänderte Dateien mit 12 neuen und 1 gelöschten Zeilen
  1. 12 1
      src/pages/ai-order-v2/AiOrderV2Page.tsx

+ 12 - 1
src/pages/ai-order-v2/AiOrderV2Page.tsx

@@ -49,6 +49,17 @@ const TASK_STATUS_MAP: Record<number, { i18nKey: string; color: string }> = {
 };
 
 const MAX_ID_LEN = 16;
+const JAPAN_TIMEZONE = "Asia/Tokyo";
+const JAPAN_DATETIME_FORMATTER = new Intl.DateTimeFormat(undefined, {
+  timeZone: JAPAN_TIMEZONE,
+  year: "numeric",
+  month: "2-digit",
+  day: "2-digit",
+  hour: "2-digit",
+  minute: "2-digit",
+  second: "2-digit",
+  hour12: false,
+});
 
 function ellipsisId(id: string) {
   if (id.length <= MAX_ID_LEN) return id;
@@ -334,7 +345,7 @@ export function AiOrderV2Page() {
     const normalizedTs = ts < 1e12 ? ts * 1000 : ts;
     const d = new Date(normalizedTs);
     if (Number.isNaN(d.getTime())) return "—";
-    return d.toLocaleString();
+    return JAPAN_DATETIME_FORMATTER.format(d);
   }
 
   const columns: TableProps<AiOrderV2Item>["columns"] = [