fix: 修正故事板历史时间时区
This commit is contained in:
@@ -45,6 +45,20 @@ function generationTaskErrorText(error: unknown, fallback: string): string {
|
|||||||
const presentation = presentGenerationError(error);
|
const presentation = presentGenerationError(error);
|
||||||
return `${presentation.title}:${presentation.description}`;
|
return `${presentation.title}:${presentation.description}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// API 时间统一以 UTC ISO 字符串返回;项目工作台固定按中国时区展示,避免直接截取 UTC 的 HH:mm。
|
||||||
|
function formatShanghaiClock(iso?: string): string {
|
||||||
|
if (!iso) return "--:--";
|
||||||
|
const date = new Date(iso);
|
||||||
|
if (Number.isNaN(date.getTime())) return "--:--";
|
||||||
|
return new Intl.DateTimeFormat("zh-CN", {
|
||||||
|
timeZone: "Asia/Shanghai",
|
||||||
|
hour: "2-digit",
|
||||||
|
minute: "2-digit",
|
||||||
|
hourCycle: "h23",
|
||||||
|
}).format(date);
|
||||||
|
}
|
||||||
|
|
||||||
// 毫秒 → mm:ss(时间轴 / 字幕展示)
|
// 毫秒 → mm:ss(时间轴 / 字幕展示)
|
||||||
function fmtMs(ms: number): string {
|
function fmtMs(ms: number): string {
|
||||||
const total = Math.max(0, Math.round(ms / 1000));
|
const total = Math.max(0, Math.round(ms / 1000));
|
||||||
@@ -3374,7 +3388,7 @@ export function PipelinePage(props: {
|
|||||||
return (
|
return (
|
||||||
<div className={`sb-history-thumb${isViewed ? " current" : ""}`} key={ver.id} data-vi={ver.id} role="button" tabIndex={0} title={isAdopted ? "当前采用版(点击预览)" : "点击预览此版本"} onClick={() => setSbViewVerId(ver.id)} onKeyDown={(event) => { if (event.key === "Enter" || event.key === " ") { event.preventDefault(); setSbViewVerId(ver.id); } }}>
|
<div className={`sb-history-thumb${isViewed ? " current" : ""}`} key={ver.id} data-vi={ver.id} role="button" tabIndex={0} title={isAdopted ? "当前采用版(点击预览)" : "点击预览此版本"} onClick={() => setSbViewVerId(ver.id)} onKeyDown={(event) => { if (event.key === "Enter" || event.key === " ") { event.preventDefault(); setSbViewVerId(ver.id); } }}>
|
||||||
<div className={`placeholder${cover ? " has-mock-media" : ""}`} style={cover ? mediaStyle(cover) : undefined}><span className="ph-frame">{isAdopted ? "采用" : "历史"}</span></div>
|
<div className={`placeholder${cover ? " has-mock-media" : ""}`} style={cover ? mediaStyle(cover) : undefined}><span className="ph-frame">{isAdopted ? "采用" : "历史"}</span></div>
|
||||||
<div className="ts">{(ver.created_at || "").slice(11, 16) || "--:--"}</div>
|
<div className="ts">{formatShanghaiClock(ver.created_at)}</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}) : <span className="muted-2 mono" style={{ fontSize: "12px" }}>// 本场暂无历史</span>}
|
}) : <span className="muted-2 mono" style={{ fontSize: "12px" }}>// 本场暂无历史</span>}
|
||||||
|
|||||||
Reference in New Issue
Block a user