Skip to content

Commit ebe5a46

Browse files
committed
feat(auction-detail): auction format ago time util 비교 추가
1 parent ec9a8d9 commit ebe5a46

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

src/screens/auction/auction-detail/ui/auction-detail-screen.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export default function AuctionDetailScreen({
4343
/>
4444
);
4545
}
46+
console.log(data.recentPriceHistory);
4647
return (
4748
<ScrollArea className="h-[calc(100vh-var(--header-h))] lg:h-[calc(100vh-var(--header-h))]">
4849
<AuctionViewerProvider initCount={data.viewerCount}>

src/shared/lib/utils/time/format.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
import { dayjs } from "@/shared/lib/utils/dayjs";
22

3+
export function parseKstLocalDateTime(input: string) {
4+
const normalized = input.replace(/(\.\d{3})\d+$/, "$1");
5+
return dayjs.tz(normalized, "Asia/Seoul");
6+
}
7+
38
export function formatAgo(input: string | Date | number): string {
49
const now = dayjs();
5-
const t = dayjs(input);
10+
11+
const t = typeof input === "string" ? parseKstLocalDateTime(input) : dayjs(input);
612

713
if (!t.isValid()) return "";
814

0 commit comments

Comments
 (0)