refactor(utils): Update date formatters to control time visibility

The `unixToDate` and `msToDate` utility functions have been updated to provide more control over the output format. They now accept an object with a `hasTime` boolean property, allowing the caller to specify whether the time should be included in the formatted date string.

This change was implemented to hide the time portion of the `seen_at` field on the notification details page, displaying only the date. All existing calls to these functions across the application have been updated to use the new signature.
This commit is contained in:
AmirReza Jamali
2025-09-27 10:29:28 +03:30
parent da250b805d
commit e7089a2e60
6 changed files with 19 additions and 20 deletions
@@ -5,6 +5,7 @@ import { ShowcaseSection } from "@/components/Layouts/showcase-section";
import IsVisible from "@/components/ui/IsVisible";
import { useGetNotificationDetails } from "@/hooks/queries/useNotificationQueries";
import { BreadcrumbItem } from "@/types/shared";
import { unixToDate } from "@/utils/shared";
import { use } from "react";
interface IProps {
@@ -60,7 +61,7 @@ const NotificationDetailsPage = ({ params }: IProps) => {
</IsVisible>
<IsVisible condition={!!data?.data.seen_at}>
<ShowcaseSection title="Seen at">
{data?.data.seen_at}
{unixToDate({ unix: data?.data.seen_at ?? 0, hasTime: false })}
</ShowcaseSection>
</IsVisible>
+2 -10
View File
@@ -4,20 +4,12 @@ import { LocationIcon } from "@/assets/icons";
import Breadcrumb from "@/components/Breadcrumbs/Breadcrumb";
import { ShowcaseSection } from "@/components/Layouts/showcase-section";
import Status from "@/components/ui/Status";
import {
Table,
TableBody,
TableHead,
TableHeader,
TableRow,
} from "@/components/ui/table";
import { useTenderDetailQuery } from "@/hooks/queries";
import { useGetFlagQuery } from "@/hooks/queries/useFlagsQueries";
import { msToDate, unixToDate } from "@/utils/shared";
import { msToDate } from "@/utils/shared";
import getSymbolFromCurrency from "currency-symbol-map";
import { use } from "react";
import { TableCell } from "../../../components/ui/table";
import Link from "next/link";
import { use } from "react";
interface IProps {
params: Promise<{