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:
@@ -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>
|
||||
|
||||
|
||||
@@ -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<{
|
||||
|
||||
Reference in New Issue
Block a user