Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

refactor(frontend): HumanizeTs takes the instant in milliseconds

zchpetercb1a6779b93c
diff --git a/frontend/src/components/AuditLogTable.tsx b/frontend/src/components/AuditLogTable.tsx
index aa92f6a499..0cd713d4ca 100644
--- a/frontend/src/components/AuditLogTable.tsx
+++ b/frontend/src/components/AuditLogTable.tsx
@@ -445,7 +445,7 @@ function useColumnDefs(): ColumnDef[] {
log.createTime ? (
<HumanizeTs
mode="datetime"
- ts={getTimeForPbTimestampProtoEs(log.createTime) / 1000}
+ tsMs={getTimeForPbTimestampProtoEs(log.createTime)}
/>
) : (
"-"
diff --git a/frontend/src/components/HumanizeTs.test.tsx b/frontend/src/components/HumanizeTs.test.tsx
index 787aa9d153..73d0250b54 100644
--- a/frontend/src/components/HumanizeTs.test.tsx
+++ b/frontend/src/components/HumanizeTs.test.tsx
@@ -109,9 +109,7 @@ const advanceSeconds = (seconds: number) => {
}
};
-const secondsAgo = (seconds: number) =>
- Math.floor(Date.now() / 1000) - seconds;
-
+const secondsAgo = (seconds: number) => Date.now() - seconds * 1000;
describe("HumanizeTs", () => {
beforeEach(() => {
@@ -136,7 +134,7 @@ describe("HumanizeTs", () => {
"renders the %s reading and restores the full time on hover",
async (mode, prefix) => {
const { container, root } = mount();
- act(() => root.render(<HumanizeTs mode={mode} ts={1000} />));
+ act(() => root.render(<HumanizeTs mode={mode} tsMs={1_000_000} />));
expect(container.textContent).toContain(prefix);
await openTooltip(container.firstElementChild);
@@ -146,7 +144,7 @@ describe("HumanizeTs", () => {
test("builds the full time only once the tooltip opens", async () => {
const { container, root } = mount();
- act(() => root.render(<HumanizeTs ts={1000} />));
+ act(() => root.render(<HumanizeTs tsMs={1_000_000} />));
expect(formatters.formatAbsoluteDateTime).not.toHaveBeenCalled();
await openTooltip(container.firstElementChild);
@@ -156,7 +154,7 @@ describe("HumanizeTs", () => {
test("renders one element, so layout classes reach the box that lays out", () => {
const { container, root } = mount();
act(() =>
- root.render(<HumanizeTs className="block truncate" ts={1000} />)
+ root.render(<HumanizeTs className="block truncate" tsMs={1_000_000} />)
);
expect(container.childElementCount).toBe(1);
expect(container.firstElementChild?.className).toContain("block truncate");
@@ -165,7 +163,7 @@ describe("HumanizeTs", () => {
test("offers the age on a full cell, and keeps it counting while open", async () => {
const { container, root } = mount();
- act(() => root.render(<HumanizeTs mode="datetime" ts={secondsAgo(30)} />));
+ act(() => root.render(<HumanizeTs mode="datetime" tsMs={secondsAgo(30)} />));
expect(container.textContent).toContain("absolute:");
await openTooltip(container.firstElementChild);
@@ -184,11 +182,11 @@ describe("HumanizeTs", () => {
// An unvalidated string reaching `new Date(...)` gives NaN, and Intl throws
// on it; the row should lose its timestamp, not the page its subtree.
const { container, root } = mount();
- act(() => root.render(<HumanizeTs ts={Number.NaN} />));
+ act(() => root.render(<HumanizeTs tsMs={Number.NaN} />));
expect(container.textContent).toBe("");
- // Finite, and still no instant it can name: Intl throws on this too.
- act(() => root.render(<HumanizeTs ts={1e15} />));
+ // Finite, and one millisecond past the last instant there is.
+ act(() => root.render(<HumanizeTs tsMs={8.64e15 + 1} />));
expect(container.textContent).toBe("");
});
@@ -197,7 +195,7 @@ describe("HumanizeTs", () => {
// own useTranslation subscription: a reading holds no locale, and a fixed
// one holds no subscription to the clock either.
const { container, root } = mount();
- act(() => root.render(<HumanizeTs ts={1000} mode="compact" />));
+ act(() => root.render(<HumanizeTs tsMs={1_000_000} mode="compact" />));
expect(container.textContent).toContain("compact:1000000:en");
act(() => language.switchTo("zh-CN"));
@@ -206,7 +204,7 @@ describe("HumanizeTs", () => {
test("omits the tooltip when tooltip is false", async () => {
const { container, root } = mount();
- act(() => root.render(<HumanizeTs ts={1000} tooltip={false} />));
+ act(() => root.render(<HumanizeTs tsMs={1_000_000} tooltip={false} />));
expect(container.textContent).toContain("queue:");
await openTooltip(container.firstElementChild);
@@ -215,7 +213,7 @@ describe("HumanizeTs", () => {
test("keeps a mounted work-queue label up with the clock", () => {
const { container, root } = mount();
- act(() => root.render(<HumanizeTs ts={secondsAgo(30)} tooltip={false} />));
+ act(() => root.render(<HumanizeTs tsMs={secondsAgo(30)} tooltip={false} />));
expect(container.textContent).toBe("queue:30000");
// The work-queue reading's boundary is 60s after the timestamp.
@@ -230,7 +228,7 @@ describe("HumanizeTs", () => {
(mode) => {
const { root } = mount();
act(() =>
- root.render(<HumanizeTs mode={mode} ts={secondsAgo(30)} tooltip={false} />)
+ root.render(<HumanizeTs mode={mode} tsMs={secondsAgo(30)} tooltip={false} />)
);
expect(vi.getTimerCount()).toBe(0);
}
diff --git a/frontend/src/components/HumanizeTs.tsx b/frontend/src/components/HumanizeTs.tsx
index f46ce60e21..3a59942620 100644
--- a/frontend/src/components/HumanizeTs.tsx
+++ b/frontend/src/components/HumanizeTs.tsx
@@ -27,8 +27,8 @@ import {
export type TimeDisplayMode = "queue" | "compact" | "operational" | "datetime";
interface HumanizeTsProps {
- /** Unix timestamp in seconds. */
- ts: number;
+ /** The instant to show, in milliseconds. */
+ tsMs: number;
mode?: TimeDisplayMode;
className?: string;
/**
@@ -71,7 +71,7 @@ const MODES: Record<
* way to display a record timestamp across the app.
*/
export function HumanizeTs({
- ts,
+ tsMs: instantMs,
mode = "queue",
className,
tooltip = true,
@@ -80,7 +80,7 @@ export function HumanizeTs({
useTranslation();
// A row loses its timestamp rather than the page its subtree: what is not an
// instant has no rendering, and the formatters throw on it.
- const tsMs = displayableInstantMs(ts * 1000);
+ const tsMs = displayableInstantMs(instantMs);
const { label: labelReading, Hidden } = MODES[mode];
const label = useTimeReading(labelReading, tsMs);
if (tsMs === undefined) {
diff --git a/frontend/src/components/IAMRemindDialog.tsx b/frontend/src/components/IAMRemindDialog.tsx
index 75d37d6280..1a6e5c2d3d 100644
--- a/frontend/src/components/IAMRemindDialog.tsx
+++ b/frontend/src/components/IAMRemindDialog.tsx
@@ -107,10 +107,7 @@ export function IAMRemindDialog({ project }: IAMRemindDialogProps) {
<li key={role.name}>
{displayRoleTitle(role.name)}:{" "}
<span className="text-error">
- <HumanizeTs
- mode="operational"
- ts={expiration.getTime() / 1000}
- />
+ <HumanizeTs mode="operational" tsMs={expiration.getTime()} />
</span>
</li>
))}
diff --git a/frontend/src/components/IssueTable.tsx b/frontend/src/components/IssueTable.tsx
index 381fdde7d4..7d90d95c30 100644
--- a/frontend/src/components/IssueTable.tsx
+++ b/frontend/src/components/IssueTable.tsx
@@ -637,9 +637,7 @@ export const IssueListItem = memo(function IssueListItem({
const issueProject = useMemo(() => projectOfIssue(issue), [issue]);
- const createTimeTs = issue.createTime
- ? Math.floor(getTimeForPbTimestampProtoEs(issue.createTime) / 1000)
- : undefined;
+ const createTimeMs = getTimeForPbTimestampProtoEs(issue.createTime);
const issueUrl = useMemo(() => {
const issueRoute = getIssueRoute(issue);
@@ -769,11 +767,11 @@ export const IssueListItem = memo(function IssueListItem({
</div>
<div className="flex items-center flex-wrap gap-x-1 text-xs text-control-light mt-1">
<span className="opacity-80">#{extractIssueUID(issue.name)}</span>
- {createTimeTs !== undefined && (
+ {createTimeMs !== undefined && (
<>
<span>&middot;</span>
{t("common.created")}
- <HumanizeTs ts={createTimeTs} />
+ <HumanizeTs tsMs={createTimeMs} />
</>
)}
<span>&middot;</span>
diff --git a/frontend/src/components/database/DatabaseOverviewInfo.tsx b/frontend/src/components/database/DatabaseOverviewInfo.tsx
index 28261081cb..3df73b7eff 100644
--- a/frontend/src/components/database/DatabaseOverviewInfo.tsx
+++ b/frontend/src/components/database/DatabaseOverviewInfo.tsx
@@ -1,6 +1,7 @@
import { useTranslation } from "react-i18next";
import { HumanizeTs } from "@/components/HumanizeTs";
import { useAppDatabaseMetadata } from "@/hooks/useAppDatabaseMetadata";
+import { getTimeForPbTimestampProtoEs } from "@/types";
import { Engine, State } from "@/types/proto-es/v1/common_pb";
import {
type Database,
@@ -15,9 +16,7 @@ export function DatabaseOverviewInfo({ database }: { database: Database }) {
const { t } = useTranslation();
const databaseEngine = getDatabaseEngine(database);
const databaseSchemaMetadata = useAppDatabaseMetadata(database.name);
- const lastSyncTs = database.successfulSyncTime
- ? Number(database.successfulSyncTime.seconds)
- : 0;
+ const lastSyncMs = getTimeForPbTimestampProtoEs(database.successfulSyncTime);
return (
<div className="rounded-sm border border-block-border px-5 py-4">
@@ -76,7 +75,7 @@ export function DatabaseOverviewInfo({ database }: { database: Database }) {
{t("database.last-sync")}
</dt>
<dd className="mt-1 text-sm text-main">
- {lastSyncTs ? <HumanizeTs ts={lastSyncTs} /> : "-"}
+ {lastSyncMs !== undefined ? <HumanizeTs tsMs={lastSyncMs} /> : "-"}
</dd>
</div>
</dl>
diff --git a/frontend/src/components/issue-activity/IssueCommentActivity.tsx b/frontend/src/components/issue-activity/IssueCommentActivity.tsx
index c994d819e1..e44bc7ef87 100644
--- a/frontend/src/components/issue-activity/IssueCommentActivity.tsx
+++ b/frontend/src/components/issue-activity/IssueCommentActivity.tsx
@@ -240,10 +240,7 @@ function IssueCommentHeader({
</Badge>
)}
{comment.createTime && (
- <HumanizeTs
- className="text-xs text-control-light"
- ts={createdTs / 1000}
- />
+ <HumanizeTs className="text-xs text-control-light" tsMs={createdTs} />
)}
{isEdited && (
<span className="text-control-light text-xs">
diff --git a/frontend/src/components/plan-check/PlanCheckSection.tsx b/frontend/src/components/plan-check/PlanCheckSection.tsx
index 56eb13477f..4d30e79001 100644
--- a/frontend/src/components/plan-check/PlanCheckSection.tsx
+++ b/frontend/src/components/plan-check/PlanCheckSection.tsx
@@ -362,11 +362,9 @@ export function PlanCheckResultsDrawer({
{group.createTime && (
<HumanizeTs
className="text-xs text-control-light"
- ts={
- getTimeForPbTimestampProtoEs(
- group.createTime
- ) / 1000
- }
+ tsMs={getTimeForPbTimestampProtoEs(
+ group.createTime
+ )}
/>
)}
</div>
diff --git a/frontend/src/components/release/ReleaseInfoCard.tsx b/frontend/src/components/release/ReleaseInfoCard.tsx
index f93df9e081..da64943a02 100644
--- a/frontend/src/components/release/ReleaseInfoCard.tsx
+++ b/frontend/src/components/release/ReleaseInfoCard.tsx
@@ -170,7 +170,7 @@ function ReleaseBlock({ release }: Readonly<{ release: Release }>) {
{createdTimeMs !== undefined && (
<HumanizeTs
className="text-xs text-control-light"
- ts={createdTimeMs / 1000}
+ tsMs={createdTimeMs}
/>
)}
</div>
diff --git a/frontend/src/components/revision/RevisionDetailPanel.tsx b/frontend/src/components/revision/RevisionDetailPanel.tsx
index faa59737c2..fbe570a692 100644
--- a/frontend/src/components/revision/RevisionDetailPanel.tsx
+++ b/frontend/src/components/revision/RevisionDetailPanel.tsx
@@ -142,7 +142,7 @@ export function RevisionDetailPanel({
{createTimeMs !== undefined ? (
<>
<span aria-hidden="true">•</span>
- <HumanizeTs mode="datetime" ts={createTimeMs / 1000} />
+ <HumanizeTs mode="datetime" tsMs={createTimeMs} />
</>
) : null}
</div>
diff --git a/frontend/src/modules/agent/components/AgentWindow.tsx b/frontend/src/modules/agent/components/AgentWindow.tsx
index 1d3437a18a..914f112e78 100644
--- a/frontend/src/modules/agent/components/AgentWindow.tsx
+++ b/frontend/src/modules/agent/components/AgentWindow.tsx
@@ -1099,7 +1099,7 @@ export function AgentWindow() {
content={formatAbsoluteDateTime(chat.updatedTs)}
>
<HumanizeTs
- ts={Math.floor(chat.updatedTs / 1000)}
+ tsMs={chat.updatedTs}
tooltip={false}
/>
</AgentTooltip>
diff --git a/frontend/src/modules/sql-editor/components/HistoryPane.tsx b/frontend/src/modules/sql-editor/components/HistoryPane.tsx
index d3533bc88e..206e9a7d96 100644
--- a/frontend/src/modules/sql-editor/components/HistoryPane.tsx
+++ b/frontend/src/modules/sql-editor/components/HistoryPane.tsx
@@ -201,7 +201,7 @@ export function HistoryPane() {
<HumanizeTs
className="text-xs text-control-placeholder"
mode="compact"
- ts={getTimeForPbTimestampProtoEs(history.createTime) / 1000}
+ tsMs={getTimeForPbTimestampProtoEs(history.createTime)}
/>
)}
</div>
diff --git a/frontend/src/modules/sql-editor/components/SchemaPane/SchemaPane.test.tsx b/frontend/src/modules/sql-editor/components/SchemaPane/SchemaPane.test.tsx
index 04da4b52da..22e6cfffa1 100644
--- a/frontend/src/modules/sql-editor/components/SchemaPane/SchemaPane.test.tsx
+++ b/frontend/src/modules/sql-editor/components/SchemaPane/SchemaPane.test.tsx
@@ -106,7 +106,7 @@ vi.mock("@/types", () => ({
dialectOfEngineV1: () => "MYSQL",
languageOfEngineV1: () => "sql",
typeToView: (type: string) => type.toUpperCase(),
- getDateForPbTimestampProtoEs: () => undefined,
+ getTimeForPbTimestampProtoEs: () => undefined,
}));
vi.mock("@/types/proto-es/v1/common_pb", () => ({
diff --git a/frontend/src/modules/sql-editor/components/SchemaPane/SyncSchemaButton.test.tsx b/frontend/src/modules/sql-editor/components/SchemaPane/SyncSchemaButton.test.tsx
index b19d3414e6..5cd0cbcb72 100644
--- a/frontend/src/modules/sql-editor/components/SchemaPane/SyncSchemaButton.test.tsx
+++ b/frontend/src/modules/sql-editor/components/SchemaPane/SyncSchemaButton.test.tsx
@@ -81,7 +81,7 @@ vi.mock("@/modules/sql-editor/hooks/useSQLEditorState", () => ({
}));
vi.mock("@/types", () => ({
- getDateForPbTimestampProtoEs: () => undefined,
+ getTimeForPbTimestampProtoEs: () => undefined,
isValidDatabaseName: mocks.isValidDatabaseName,
}));
diff --git a/frontend/src/modules/sql-editor/components/SchemaPane/SyncSchemaButton.tsx b/frontend/src/modules/sql-editor/components/SchemaPane/SyncSchemaButton.tsx
index 2276d3ca98..d18ca9e1f7 100644
--- a/frontend/src/modules/sql-editor/components/SchemaPane/SyncSchemaButton.tsx
+++ b/frontend/src/modules/sql-editor/components/SchemaPane/SyncSchemaButton.tsx
@@ -7,7 +7,7 @@ import { Tooltip } from "@/components/ui/tooltip";
import { cn } from "@/lib/utils";
import { useConnectionOfCurrentSQLEditorTab } from "@/modules/sql-editor/hooks/useSQLEditorState";
import { useAppStore } from "@/stores/app";
-import { getDateForPbTimestampProtoEs, isValidDatabaseName } from "@/types";
+import { getTimeForPbTimestampProtoEs, isValidDatabaseName } from "@/types";
/**
* RefreshCcw button with a hover tooltip showing the last sync time +
@@ -42,12 +42,7 @@ export function SyncSchemaButton({ className }: { className?: string }) {
}
};
- const lastSyncDate = getDateForPbTimestampProtoEs(
- database.successfulSyncTime
- );
- const lastSyncTs = lastSyncDate
- ? Math.floor(lastSyncDate.getTime() / 1000)
- : 0;
+ const lastSyncMs = getTimeForPbTimestampProtoEs(database.successfulSyncTime);
const button = (
<Button
@@ -78,11 +73,11 @@ export function SyncSchemaButton({ className }: { className?: string }) {
side="bottom"
content={
<div className="flex flex-col gap-1">
- {lastSyncTs > 0 ? (
+ {lastSyncMs !== undefined ? (
<Trans
t={t}
i18nKey="sql-editor.last-synced"
- components={{ time: <HumanizeTs ts={lastSyncTs} /> }}
+ components={{ time: <HumanizeTs tsMs={lastSyncMs} /> }}
/>
) : null}
<div>
diff --git a/frontend/src/routes/project/DatabaseChangelogDetailPage.tsx b/frontend/src/routes/project/DatabaseChangelogDetailPage.tsx
index 9292e493d0..a950c97447 100644
--- a/frontend/src/routes/project/DatabaseChangelogDetailPage.tsx
+++ b/frontend/src/routes/project/DatabaseChangelogDetailPage.tsx
@@ -405,7 +405,7 @@ export function DatabaseChangelogDetailPage({
{createTimeMs !== undefined ? (
<>
<span aria-hidden="true">•</span>
- <HumanizeTs mode="datetime" ts={createTimeMs / 1000} />
+ <HumanizeTs mode="datetime" tsMs={createTimeMs} />
</>
) : null}
</div>
diff --git a/frontend/src/routes/project/ProjectAccessGrantsPage.tsx b/frontend/src/routes/project/ProjectAccessGrantsPage.tsx
index c4d3309fc4..779dd5cf36 100644
--- a/frontend/src/routes/project/ProjectAccessGrantsPage.tsx
+++ b/frontend/src/routes/project/ProjectAccessGrantsPage.tsx
@@ -762,7 +762,7 @@ function AccessGrantRow({
</TableCell>
<TableCell>
{createdTimeMs !== undefined ? (
- <HumanizeTs className="block truncate" ts={createdTimeMs / 1000} />
+ <HumanizeTs className="block truncate" tsMs={createdTimeMs} />
) : (
"-"
)}
@@ -772,7 +772,7 @@ function AccessGrantRow({
<HumanizeTs
className="block truncate"
mode="operational"
- ts={expireTimeMs / 1000}
+ tsMs={expireTimeMs}
/>
) : (
"-"
diff --git a/frontend/src/routes/project/ProjectMaskingExemptionPage.tsx b/frontend/src/routes/project/ProjectMaskingExemptionPage.tsx
index c019fcb33f..e4d947a8bc 100644
--- a/frontend/src/routes/project/ProjectMaskingExemptionPage.tsx
+++ b/frontend/src/routes/project/ProjectMaskingExemptionPage.tsx
@@ -1117,7 +1117,7 @@ function ExemptionGrantSection({
<HumanizeTs
className="text-xs text-control-light line-through"
mode="operational"
- ts={grant.expirationTimestamp / 1000}
+ tsMs={grant.expirationTimestamp}
/>
<span className="text-xs text-control-light">
({t("sql-editor.expired")})
@@ -1137,7 +1137,7 @@ function ExemptionGrantSection({
(
<HumanizeTs
mode="operational"
- ts={grant.expirationTimestamp / 1000}
+ tsMs={grant.expirationTimestamp}
/>
)
</span>
diff --git a/frontend/src/routes/project/ProjectPlanDashboardPage.tsx b/frontend/src/routes/project/ProjectPlanDashboardPage.tsx
index df77426cd8..391fd28ac2 100644
--- a/frontend/src/routes/project/ProjectPlanDashboardPage.tsx
+++ b/frontend/src/routes/project/ProjectPlanDashboardPage.tsx
@@ -378,7 +378,7 @@ interface PlanColumn {
interface PlanRowContext {
creator: { title: string; name: string };
- updateTimeTs: number | undefined;
+ updateTimeMs: number | undefined;
approvalTag: { label: string; variant: ReviewBadge["variant"] } | undefined;
isDeleted: boolean;
draftState: PlanDraftState;
@@ -510,11 +510,11 @@ function PlanTable({
minWidth: 100,
resizable: true,
render: (_plan, ctx) =>
- ctx.updateTimeTs === undefined ? (
+ ctx.updateTimeMs === undefined ? (
<span className="text-control-light">-</span>
) : (
<HumanizeTs
- ts={ctx.updateTimeTs}
+ tsMs={ctx.updateTimeMs}
className="text-control-light whitespace-nowrap"
/>
),
@@ -607,9 +607,7 @@ function PlanRow({
);
const creator = creatorUser || unknownUser(plan.creator);
- const updateTimeTs = plan.updateTime
- ? Math.floor(getTimeForPbTimestampProtoEs(plan.updateTime) / 1000)
- : undefined;
+ const updateTimeMs = getTimeForPbTimestampProtoEs(plan.updateTime);
const planUrl = useMemo(() => {
return router.resolve({
@@ -646,7 +644,7 @@ function PlanRow({
const ctx: PlanRowContext = {
creator,
- updateTimeTs,
+ updateTimeMs,
approvalTag,
isDeleted,
draftState,
diff --git a/frontend/src/routes/project/ProjectReleaseDashboardPage.tsx b/frontend/src/routes/project/ProjectReleaseDashboardPage.tsx
index cd0154f471..c01ccdfbd2 100644
--- a/frontend/src/routes/project/ProjectReleaseDashboardPage.tsx
+++ b/frontend/src/routes/project/ProjectReleaseDashboardPage.tsx
@@ -293,11 +293,7 @@ function ReleaseRow({ release }: { release: Release }) {
</div>
</TableCell>
<TableCell>
- {createTimeMs === undefined ? (
- "-"
- ) : (
- <HumanizeTs ts={createTimeMs / 1000} />
- )}
+ {createTimeMs === undefined ? "-" : <HumanizeTs tsMs={createTimeMs} />}
</TableCell>
</TableRow>
);
diff --git a/frontend/src/routes/project/ProjectReleaseDetailPage.tsx b/frontend/src/routes/project/ProjectReleaseDetailPage.tsx
index 0ee86d15f2..642712939d 100644
--- a/frontend/src/routes/project/ProjectReleaseDetailPage.tsx
+++ b/frontend/src/routes/project/ProjectReleaseDetailPage.tsx
@@ -179,11 +179,7 @@ export function ProjectReleaseDetailPage({
</div>
<ReleaseBasicInfo
- createTime={
- release.createTime
- ? getTimeForPbTimestampProtoEs(release.createTime) / 1000
- : undefined
- }
+ createTimeMs={getTimeForPbTimestampProtoEs(release.createTime)}
vcsType={release.vcsSource?.vcsType}
vcsUrl={release.vcsSource?.url}
/>
@@ -248,11 +244,11 @@ function beautifyUrl(url: string): string {
}
function ReleaseBasicInfo({
- createTime,
+ createTimeMs,
vcsType,
vcsUrl,
}: {
- createTime: number | undefined;
+ createTimeMs: number | undefined;
vcsType: VCSType | undefined;
vcsUrl: string | undefined;
}) {
@@ -263,8 +259,8 @@ function ReleaseBasicInfo({
<div className="flex flex-row items-center pl-1 gap-4">
<div className="flex items-center gap-1">
<Clock4 className="size-4 text-control-light" />
- {createTime !== undefined && (
- <HumanizeTs ts={createTime} className="text-sm text-control" />
+ {createTimeMs !== undefined && (
+ <HumanizeTs tsMs={createTimeMs} className="text-sm text-control" />
)}
</div>
{showVcs && (
diff --git a/frontend/src/routes/project/ProjectSyncSchemaPage.tsx b/frontend/src/routes/project/ProjectSyncSchemaPage.tsx
index 0dc8876e1a..63a208ef5a 100644
--- a/frontend/src/routes/project/ProjectSyncSchemaPage.tsx
+++ b/frontend/src/routes/project/ProjectSyncSchemaPage.tsx
@@ -884,7 +884,7 @@ function ChangelogLabel({ entry }: { entry: ChangelogEntry }) {
<span className="flex items-center gap-1.5 truncate">
<span className="text-control-light">
{entry.date ? (
- <HumanizeTs ts={entry.date.getTime() / 1000} />
+ <HumanizeTs tsMs={entry.date.getTime()} />
) : (
"Latest version"
)}
diff --git a/frontend/src/routes/project/database-detail/changelog/DatabaseChangelogTable.tsx b/frontend/src/routes/project/database-detail/changelog/DatabaseChangelogTable.tsx
index 906373c9f1..9a7768c736 100644
--- a/frontend/src/routes/project/database-detail/changelog/DatabaseChangelogTable.tsx
+++ b/frontend/src/routes/project/database-detail/changelog/DatabaseChangelogTable.tsx
@@ -103,9 +103,7 @@ export function DatabaseChangelogTable({
{changelog.createTime ? (
<HumanizeTs
mode="compact"
- ts={
- getTimeForPbTimestampProtoEs(changelog.createTime) / 1000
- }
+ tsMs={getTimeForPbTimestampProtoEs(changelog.createTime)}
/>
) : (
"-"
diff --git a/frontend/src/routes/project/database-detail/revision/DatabaseRevisionTable.tsx b/frontend/src/routes/project/database-detail/revision/DatabaseRevisionTable.tsx
index 4023323796..59f915977b 100644
--- a/frontend/src/routes/project/database-detail/revision/DatabaseRevisionTable.tsx
+++ b/frontend/src/routes/project/database-detail/revision/DatabaseRevisionTable.tsx
@@ -108,7 +108,7 @@ export function DatabaseRevisionTable({
{revision.createTime ? (
<HumanizeTs
mode="compact"
- ts={getTimeForPbTimestampProtoEs(revision.createTime) / 1000}
+ tsMs={getTimeForPbTimestampProtoEs(revision.createTime)}
/>
) : (
"-"
diff --git a/frontend/src/routes/project/issue-detail/components/IssueDetailAccessGrantDetails.tsx b/frontend/src/routes/project/issue-detail/components/IssueDetailAccessGrantDetails.tsx
index 4a7c64ce9b..e40867df2d 100644
--- a/frontend/src/routes/project/issue-detail/components/IssueDetailAccessGrantDetails.tsx
+++ b/frontend/src/routes/project/issue-detail/components/IssueDetailAccessGrantDetails.tsx
@@ -171,7 +171,7 @@ export function IssueDetailAccessGrantDetails() {
) : (
<HumanizeTs
mode="operational"
- ts={expirationInfo.expireTimeMs / 1000}
+ tsMs={expirationInfo.expireTimeMs}
/>
)}
</div>
diff --git a/frontend/src/routes/project/issue-detail/components/IssueDetailCommentList.tsx b/frontend/src/routes/project/issue-detail/components/IssueDetailCommentList.tsx
index 4caf0a2afc..0ea7bffe0a 100644
--- a/frontend/src/routes/project/issue-detail/components/IssueDetailCommentList.tsx
+++ b/frontend/src/routes/project/issue-detail/components/IssueDetailCommentList.tsx
@@ -426,12 +426,10 @@ function IssueDescriptionCommentRow({
{page.issue?.createTime && (
<HumanizeTs
className="text-control-light"
- ts={
- getTimeForPbTimestampProtoEs(
- page.issue.createTime,
- 0
- ) / 1000
- }
+ tsMs={getTimeForPbTimestampProtoEs(
+ page.issue.createTime,
+ 0
+ )}
/>
)}
</div>
diff --git a/frontend/src/routes/project/issue-detail/components/IssueDetailRoleGrantDetails.tsx b/frontend/src/routes/project/issue-detail/components/IssueDetailRoleGrantDetails.tsx
index 71bc2e80dc..4a44df0e5d 100644
--- a/frontend/src/routes/project/issue-detail/components/IssueDetailRoleGrantDetails.tsx
+++ b/frontend/src/routes/project/issue-detail/components/IssueDetailRoleGrantDetails.tsx
@@ -162,7 +162,7 @@ export function IssueDetailRoleGrantDetails() {
{condition?.expiredTime ? (
<HumanizeTs
mode="operational"
- ts={new Date(condition.expiredTime).getTime() / 1000}
+ tsMs={new Date(condition.expiredTime).getTime()}
/>
) : (
t("project.members.never-expires")
diff --git a/frontend/src/routes/project/issue-detail/components/IssueDetailTaskRunTable.tsx b/frontend/src/routes/project/issue-detail/components/IssueDetailTaskRunTable.tsx
index a338d55a5c..8cb01f4208 100644
--- a/frontend/src/routes/project/issue-detail/components/IssueDetailTaskRunTable.tsx
+++ b/frontend/src/routes/project/issue-detail/components/IssueDetailTaskRunTable.tsx
@@ -183,7 +183,7 @@ function IssueDetailTaskRunDateCell({ date }: { date?: Timestamp }) {
return (
<HumanizeTs
mode="compact"
- ts={getTimeForPbTimestampProtoEs(date) / 1000}
+ tsMs={getTimeForPbTimestampProtoEs(date)}
className="text-sm text-control"
/>
);
diff --git a/frontend/src/routes/project/plan-detail/components/PlanDetailMeta.tsx b/frontend/src/routes/project/plan-detail/components/PlanDetailMeta.tsx
index 3c12254be3..d7d402700c 100644
--- a/frontend/src/routes/project/plan-detail/components/PlanDetailMeta.tsx
+++ b/frontend/src/routes/project/plan-detail/components/PlanDetailMeta.tsx
@@ -87,7 +87,7 @@ export function PlanDetailMeta() {
{createdTimeMs !== undefined && (
<>
<span aria-hidden="true">·</span>
- <HumanizeTs ts={createdTimeMs / 1000} />
+ <HumanizeTs tsMs={createdTimeMs} />
</>
)}
diff --git a/frontend/src/routes/project/plan-detail/components/deploy/DeployLatestTaskRunInfo.tsx b/frontend/src/routes/project/plan-detail/components/deploy/DeployLatestTaskRunInfo.tsx
index 22b020b0e4..81e846deaf 100644
--- a/frontend/src/routes/project/plan-detail/components/deploy/DeployLatestTaskRunInfo.tsx
+++ b/frontend/src/routes/project/plan-detail/components/deploy/DeployLatestTaskRunInfo.tsx
@@ -66,7 +66,7 @@ export function DeployLatestTaskRunInfo({
<>
<span className="text-control-placeholder">·</span>
<HumanizeTs
- ts={updateDate.getTime() / 1000}
+ tsMs={updateDate.getTime()}
className="shrink-0 text-control-light"
/>
</>
diff --git a/frontend/src/routes/project/plan-detail/components/deploy/DeployTaskHeader.tsx b/frontend/src/routes/project/plan-detail/components/deploy/DeployTaskHeader.tsx
index f744f2a27f..a63d65782f 100644
--- a/frontend/src/routes/project/plan-detail/components/deploy/DeployTaskHeader.tsx
+++ b/frontend/src/routes/project/plan-detail/components/deploy/DeployTaskHeader.tsx
@@ -87,7 +87,7 @@ export function DeployTaskHeader({
{isExpanded && scheduledTimeMs !== undefined && (
<span className="flex shrink-0 items-center gap-x-1 rounded-full bg-info/10 px-2 py-0.5 text-xs text-info">
<LoaderCircle className="size-3 animate-spin motion-reduce:animate-none" />
- <HumanizeTs mode="operational" ts={scheduledTimeMs / 1000} />
+ <HumanizeTs mode="operational" tsMs={scheduledTimeMs} />
</span>
)}
</div>
@@ -104,10 +104,7 @@ export function DeployTaskHeader({
<span className="flex items-center gap-x-1 text-info">
<LoaderCircle className="size-3 animate-spin motion-reduce:animate-none" />
{scheduledTimeMs !== undefined ? (
- <HumanizeTs
- mode="operational"
- ts={scheduledTimeMs / 1000}
- />
+ <HumanizeTs mode="operational" tsMs={scheduledTimeMs} />
) : (
timingDisplay
)}
@@ -165,9 +162,7 @@ export function DeployTaskHeader({
{latestTaskRun?.createTime && (
<span className="rounded-full border bg-control-bg px-2 py-0.5 text-control-light">
<HumanizeTs
- ts={
- getTimeForPbTimestampProtoEs(latestTaskRun.createTime) / 1000
- }
+ tsMs={getTimeForPbTimestampProtoEs(latestTaskRun.createTime)}
/>
</span>
)}
diff --git a/frontend/src/routes/project/plan-detail/components/deploy/DeployTaskRunHistorySheet.tsx b/frontend/src/routes/project/plan-detail/components/deploy/DeployTaskRunHistorySheet.tsx
index e280b79c0e..8c05367f63 100644
--- a/frontend/src/routes/project/plan-detail/components/deploy/DeployTaskRunHistorySheet.tsx
+++ b/frontend/src/routes/project/plan-detail/components/deploy/DeployTaskRunHistorySheet.tsx
@@ -143,7 +143,7 @@ function TaskRunHistoryItem({
</span>
<span className="flex shrink-0 items-center gap-x-3 text-xs text-control-light">
{startMs !== undefined && (
- <HumanizeTs mode="compact" ts={startMs / 1000} />
+ <HumanizeTs mode="compact" tsMs={startMs} />
)}
{duration && (
<span className="flex items-center gap-x-1">
diff --git a/frontend/src/routes/project/plan-detail/components/review/ReviewActivityTimeline.tsx b/frontend/src/routes/project/plan-detail/components/review/ReviewActivityTimeline.tsx
index 5912b2aa43..8fbc0f517b 100644
--- a/frontend/src/routes/project/plan-detail/components/review/ReviewActivityTimeline.tsx
+++ b/frontend/src/routes/project/plan-detail/components/review/ReviewActivityTimeline.tsx
@@ -320,7 +320,7 @@ function SyntheticHeader({
{source.time && (
<HumanizeTs
className="text-xs text-control-light"
- ts={getTimeForPbTimestampProtoEs(source.time) / 1000}
+ tsMs={getTimeForPbTimestampProtoEs(source.time)}
/>
)}
</>
diff --git a/frontend/src/routes/project/plan-detail/components/review/ReviewRejectionBanner.tsx b/frontend/src/routes/project/plan-detail/components/review/ReviewRejectionBanner.tsx
index c0c9bb06ef..bf55aaaaa7 100644
--- a/frontend/src/routes/project/plan-detail/components/review/ReviewRejectionBanner.tsx
+++ b/frontend/src/routes/project/plan-detail/components/review/ReviewRejectionBanner.tsx
@@ -96,7 +96,7 @@ export function ReviewRejectionBanner({
<span className="text-error/50">·</span>
<HumanizeTs
className="text-xs font-normal text-error/70"
- ts={getTimeForPbTimestampProtoEs(rejection.createTime) / 1000}
+ tsMs={getTimeForPbTimestampProtoEs(rejection.createTime)}
/>
</>
)}
diff --git a/frontend/src/routes/project/plan-detail/components/threads/CommentThreadCard.tsx b/frontend/src/routes/project/plan-detail/components/threads/CommentThreadCard.tsx
index 6f187ba06a..4222d4cb59 100644
--- a/frontend/src/routes/project/plan-detail/components/threads/CommentThreadCard.tsx
+++ b/frontend/src/routes/project/plan-detail/components/threads/CommentThreadCard.tsx
@@ -421,7 +421,7 @@ function ThreadSummary({
{thread.root.createTime && (
<HumanizeTs
className="hidden shrink-0 text-xs text-control-light sm:inline"
- ts={getTimeForPbTimestampProtoEs(thread.root.createTime) / 1000}
+ tsMs={getTimeForPbTimestampProtoEs(thread.root.createTime)}
/>
)}
<Badge className="shrink-0 gap-x-1 px-2 text-xs" variant="success">
diff --git a/frontend/src/routes/project/plan-detail/components/threads/ThreadComment.tsx b/frontend/src/routes/project/plan-detail/components/threads/ThreadComment.tsx
index 885b5224b9..948d560ba5 100644
--- a/frontend/src/routes/project/plan-detail/components/threads/ThreadComment.tsx
+++ b/frontend/src/routes/project/plan-detail/components/threads/ThreadComment.tsx
@@ -90,7 +90,7 @@ export function ThreadComment({
{comment.createTime && (
<HumanizeTs
className="hidden shrink-0 whitespace-nowrap text-xs text-control-light @2xs/comment:inline"
- ts={createdTs / 1000}
+ tsMs={createdTs}
/>
)}
{isEdited && (
diff --git a/frontend/src/routes/project/plan-detail/components/threads/ThreadStack.tsx b/frontend/src/routes/project/plan-detail/components/threads/ThreadStack.tsx
index 103aabe666..e9239abe8e 100644
--- a/frontend/src/routes/project/plan-detail/components/threads/ThreadStack.tsx
+++ b/frontend/src/routes/project/plan-detail/components/threads/ThreadStack.tsx
@@ -224,7 +224,7 @@ function CollapsedThreadRow({
{comment.createTime && (
<HumanizeTs
className="hidden shrink-0 text-xs text-control-light @xl:inline"
- ts={getTimeForPbTimestampProtoEs(comment.createTime) / 1000}
+ tsMs={getTimeForPbTimestampProtoEs(comment.createTime)}
/>
)}
{resolved && (
diff --git a/frontend/src/routes/workspace/MembersPage.tsx b/frontend/src/routes/workspace/MembersPage.tsx
index b8b31eb96f..42304e9dda 100644
--- a/frontend/src/routes/workspace/MembersPage.tsx
+++ b/frontend/src/routes/workspace/MembersPage.tsx
@@ -1887,7 +1887,7 @@ function EditMemberRoleDrawer({
{row.expiration ? (
<HumanizeTs
mode="operational"
- ts={row.expiration.getTime() / 1000}
+ tsMs={row.expiration.getTime()}
/>
) : (
t("project.members.never-expires")