From 88b6d2a59797261f77bd0ee4cc8c8d87060c7f88 Mon Sep 17 00:00:00 2001 From: Peace Date: Wed, 27 Aug 2025 23:46:48 +0900 Subject: [PATCH] few i --- web/src/app/page.tsx | 33 +++++++++++++++++++------------ web/src/components/app-header.tsx | 22 +++++++++++---------- 2 files changed, 32 insertions(+), 23 deletions(-) diff --git a/web/src/app/page.tsx b/web/src/app/page.tsx index 5aad945..215f581 100644 --- a/web/src/app/page.tsx +++ b/web/src/app/page.tsx @@ -13,26 +13,31 @@ import { } from '@/components/ui/select'; const TIMEZONE_LIST = ['Asia/Seoul', 'America/New_York', 'Europe/London', 'Asia/Tokyo']; +const INTERVAL = 500; export default function Home() { const [now, setNow] = useState(DateTime.now()); const [timezone, setTimezone] = useState('Asia/Seoul'); + const [defNow, setDefNow] = useState(new Date()); useEffect(() => { - const timer = setInterval(() => setNow(DateTime.now()), 10); + const timer = setInterval(() => { + setNow(DateTime.now()); + setDefNow(new Date()); + }, INTERVAL); return () => clearInterval(timer); }, []); - const localNow = now.setZone(timezone); + const localNow = timezone ? now.setZone(timezone) : now; return ( -
+
- - DateTime UI Sample + + DateTime UI Sample - -
+ +
-
-
- Current time: {localNow.toFormat('yyyy-MM-dd HH:mm:ss (ZZZZ)')} -
-
- (Luxon: realtime rendering, local timezone support) +
+

Current time: {localNow.toFormat('yyyy-MM-dd HH:mm:ss (ZZZZ)')}

+

Now: {now.toFormat('yyyy-MM-dd HH:mm:ss (ZZZZ)')}

+

Default date now: {defNow.toISOString()}

+
+
+ (Luxon: realtime rendering, local timezone support) +
diff --git a/web/src/components/app-header.tsx b/web/src/components/app-header.tsx index cf371a0..2a69368 100644 --- a/web/src/components/app-header.tsx +++ b/web/src/components/app-header.tsx @@ -64,19 +64,21 @@ export default function AppHeader() {
+
) : ( - - - {initial} - - {displayName} - +
+ + + {initial} + + {displayName} + + +
)} - -
) : (