From c62ec046327fd388ebce04571b55910747e69a3b Mon Sep 17 00:00:00 2001 From: dujinkim Date: Tue, 9 Sep 2025 10:32:34 +0000 Subject: (정희성, 최겸, 대표님) formatDate 변경 등 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/bidding/bidding-info-header.tsx | 21 +-------------------- components/bidding/price-adjustment-dialog.tsx | 20 ++++++-------------- 2 files changed, 7 insertions(+), 34 deletions(-) (limited to 'components/bidding') diff --git a/components/bidding/bidding-info-header.tsx b/components/bidding/bidding-info-header.tsx index c140920b..e109a8ca 100644 --- a/components/bidding/bidding-info-header.tsx +++ b/components/bidding/bidding-info-header.tsx @@ -1,31 +1,12 @@ import { Bidding } from '@/db/schema/bidding' import { Building2, Package, User, DollarSign, Calendar } from 'lucide-react' import { contractTypeLabels, biddingTypeLabels } from '@/db/schema/bidding' +import { formatDate } from '@/lib/utils' interface BiddingInfoHeaderProps { bidding: Bidding } -function formatDate(date: Date | string | null | undefined, locale: 'KR' | 'EN' = 'KR'): string { - if (!date) return '' - - const dateObj = typeof date === 'string' ? new Date(date) : date - - if (locale === 'KR') { - return dateObj.toLocaleDateString('ko-KR', { - year: 'numeric', - month: '2-digit', - day: '2-digit' - }).replace(/\./g, '-').replace(/-$/, '') - } - - return dateObj.toLocaleDateString('en-US', { - year: 'numeric', - month: '2-digit', - day: '2-digit' - }) -} - export function BiddingInfoHeader({ bidding }: BiddingInfoHeaderProps) { return (
diff --git a/components/bidding/price-adjustment-dialog.tsx b/components/bidding/price-adjustment-dialog.tsx index b53f9ef1..982d8b90 100644 --- a/components/bidding/price-adjustment-dialog.tsx +++ b/components/bidding/price-adjustment-dialog.tsx @@ -10,6 +10,7 @@ import { } from '@/components/ui/dialog' import { Badge } from '@/components/ui/badge' import { Separator } from '@/components/ui/separator' +import { formatDate } from '@/lib/utils' interface PriceAdjustmentData { id: number @@ -39,15 +40,6 @@ interface PriceAdjustmentDialogProps { vendorName: string } -function formatDate(date: Date | null | undefined): string { - if (!date) return '-' - return new Date(date).toLocaleDateString('ko-KR', { - year: 'numeric', - month: '2-digit', - day: '2-digit', - }) -} - export function PriceAdjustmentDialog({ open, onOpenChange, @@ -135,11 +127,11 @@ export function PriceAdjustmentDialog({
-

{formatDate(data.referenceDate)}

+

{formatDate(data.referenceDate, "kr")}

-

{formatDate(data.comparisonDate)}

+

{formatDate(data.comparisonDate, "kr")}

@@ -170,7 +162,7 @@ export function PriceAdjustmentDialog({
-

{formatDate(data.adjustmentDate)}

+

{formatDate(data.adjustmentDate, "kr")}

@@ -190,8 +182,8 @@ export function PriceAdjustmentDialog({ {/* 메타 정보 */}
-

작성일: {formatDate(data.createdAt)}

-

수정일: {formatDate(data.updatedAt)}

+

작성일: {formatDate(data.createdAt, "kr")}

+

수정일: {formatDate(data.updatedAt, "kr")}

-- cgit v1.2.3