@@ -30,7 +33,7 @@ const summary = computed(() => summarizeBuilds(props.live));
{{ row.label }}
-
+
tag {{ row.tag || 'unknown' }}
diff --git a/web/hwlab-cloud-web/src/config/runtime.ts b/web/hwlab-cloud-web/src/config/runtime.ts
index 5c177d1d..23f5f110 100644
--- a/web/hwlab-cloud-web/src/config/runtime.ts
+++ b/web/hwlab-cloud-web/src/config/runtime.ts
@@ -6,6 +6,16 @@ export interface DisplayTimeConfig {
label: string;
}
+const DEFAULT_DISPLAY_DATE_TIME_OPTIONS: Intl.DateTimeFormatOptions = {
+ year: "numeric",
+ month: "2-digit",
+ day: "2-digit",
+ hour: "2-digit",
+ minute: "2-digit",
+ second: "2-digit",
+ hour12: false
+};
+
export function displayTimeConfig(): DisplayTimeConfig {
const config = window.HWLAB_CLOUD_WEB_CONFIG?.displayTime;
const timeZone = requiredDisplayTimeField(config?.timeZone, "timeZone");
@@ -24,7 +34,8 @@ export function formatDisplayDateTime(value: string | Date, options: Intl.DateTi
const date = value instanceof Date ? value : new Date(value);
if (!Number.isFinite(date.getTime())) return String(value);
const config = displayTimeConfig();
- return new Intl.DateTimeFormat(config.locale, { hour12: false, ...options, timeZone: config.timeZone }).format(date);
+ const dateTimeOptions = Object.keys(options).length > 0 ? options : DEFAULT_DISPLAY_DATE_TIME_OPTIONS;
+ return new Intl.DateTimeFormat(config.locale, { hour12: false, ...dateTimeOptions, timeZone: config.timeZone }).format(date);
}
function requiredDisplayTimeField(value: unknown, field: string): string {
diff --git a/web/hwlab-cloud-web/src/stores/workbench-live.ts b/web/hwlab-cloud-web/src/stores/workbench-live.ts
index bf9b4f70..02de84e5 100644
--- a/web/hwlab-cloud-web/src/stores/workbench-live.ts
+++ b/web/hwlab-cloud-web/src/stores/workbench-live.ts
@@ -149,7 +149,7 @@ export function formatTimestamp(value: unknown): string {
if (!text) return "未观测";
const date = new Date(text);
if (!Number.isFinite(date.getTime())) return text;
- return formatDisplayDateTime(date, { hour12: false });
+ return formatDisplayDateTime(date);
}
export function shortToken(value: unknown, size = 12): string | null {
@@ -225,7 +225,8 @@ function rowFromLiveHealth(payload: LiveProbePayload | null): BuildRow {
}
function latestBuildText(row: BuildRow): string {
- const time = row.builtAt ? `${formatTimestamp(row.builtAt)} ${displayTimeLabel()}` : "构建时间不可用";
+ const label = displayTimeLabel();
+ const time = row.builtAt ? `${formatTimestamp(row.builtAt)} ${label}` : `构建时间不可用(${label})`;
return `最新镜像构建时间:${time} · ${row.label} · tag ${row.tag ?? "unknown"} · commit ${row.commitShort ?? "unknown"} · env ${row.envImageTag ?? row.envCommitShort ?? "unknown"} · revision ${row.revisionShort ?? "unknown"}`;
}