Skip to content

Commit 8969f1f

Browse files
committed
fix(header): 用 new Date().getTime() 避免 react-hooks/purity 报错
Date.now() 被 react-hooks/purity 规则判为 render 期不纯调用, 改用与原实现一致的 new Date().getTime()。
1 parent 114fc03 commit 8969f1f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

app/components/Header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { LiveDate } from "./LiveDate";
1212

1313
export async function Header() {
1414
const t = await getTranslations("header");
15-
const editionTimestampMs = Date.now();
15+
const editionTimestampMs = new Date().getTime();
1616
return (
1717
<header className="fixed top-0 w-full z-50 bg-[var(--background)] border-b border-[var(--foreground)] py-2 transition-colors duration-300">
1818
<div className="container mx-auto px-6">

0 commit comments

Comments
 (0)