From c38c226dbd4e92631736566a9d6776bd3cd9f2a4 Mon Sep 17 00:00:00 2001 From: AmirReza Jamali Date: Sun, 3 May 2026 11:00:03 +0330 Subject: [PATCH] refactor(tender-details): integrate unixToDate for date formatting and enhance layout consistency - Replaced msToDate with unixToDate for application, publication, submission, and tender deadlines to ensure accurate date representation. - Improved ShowcaseSection layout by adjusting class names for better visual consistency across various sections. - Enhanced error message formatting for improved readability. --- src/app/tenders/[details]/page.tsx | 89 +++++++++++++++++++++++------- src/utils/shared.ts | 2 +- 2 files changed, 69 insertions(+), 22 deletions(-) diff --git a/src/app/tenders/[details]/page.tsx b/src/app/tenders/[details]/page.tsx index 3729900..7250468 100644 --- a/src/app/tenders/[details]/page.tsx +++ b/src/app/tenders/[details]/page.tsx @@ -7,7 +7,11 @@ import Status from "@/components/ui/Status"; import { useTenderDetailQuery } from "@/hooks/queries"; import { useGetFlagQuery } from "@/hooks/queries/useFlagsQueries"; import { cn } from "@/lib/utils"; -import { isValidAlpha2CountryCode, msToDate, truncateString } from "@/utils/shared"; +import { + isValidAlpha2CountryCode, + truncateString, + unixToDate, +} from "@/utils/shared"; import getSymbolFromCurrency from "currency-symbol-map"; import Link from "next/link"; import { use } from "react"; @@ -82,11 +86,12 @@ const TenderDetails = ({ params }: IProps) => { We couldn't load this tender

- Check your connection or try again. You can go back to the tender list anytime. + Check your connection or try again. You can go back to the tender + list anytime.

Back to tenders @@ -114,13 +119,15 @@ const TenderDetails = ({ params }: IProps) => {
- {tender.status} + + {tender.status} + {submissionUrl && ( Open submission @@ -136,7 +143,9 @@ const TenderDetails = ({ params }: IProps) => { Procurement
- {tender.tender_id} + + {tender.tender_id} + { {tender.buyer_organization.name} - + {tender.notice_publication_id} - - {tender.procedure_code} + + + {tender.procedure_code} + - + {tender.procurement_type_code} @@ -169,28 +189,55 @@ const TenderDetails = ({ params }: IProps) => {
Timeline
- + - + - + - + {submissionUrl && ( - + {
Location & currency
-
+

Country @@ -232,7 +279,7 @@ const TenderDetails = ({ params }: IProps) => {

{tender.currency && ( -
+

Currency diff --git a/src/utils/shared.ts b/src/utils/shared.ts index 791f977..3c734ab 100644 --- a/src/utils/shared.ts +++ b/src/utils/shared.ts @@ -8,7 +8,7 @@ export const unixToDate = ({ unix: number; hasTime?: boolean; }) => { - return moment.unix(unix).format(`YYYY/MM/DD - ${hasTime ? "HH:MM" : ""}`); + return unix === 0 ? "-" : moment.unix(unix).format(`YYYY/MM/DD - ${hasTime ? "HH:MM" : ""}`); }; export const msToDate = (ms: number) => { return moment.default(ms).format("YYYY/MM/DD");