fixed date fields

This commit is contained in:
Jelaletdin12
2026-08-31 22:36:56 +05:00
parent 9ad86634dd
commit cc5b5fca24
18 changed files with 78 additions and 53 deletions

View File

@@ -41,17 +41,28 @@ export function formatToApiDate(dateStr?: string | Date | null): string {
}
/**
* Backend'den gelen ISO UTC tarih formatını UI datepicker/input'unun beklediği 'YYYY-MM-DD' formatına çevirir.
* Örn: '1987-04-08T00:00:00Z' -> '1987-04-08'
* Backend'den gelen ISO UTC tarih formatını 'hh:mm, dd.mm.yyyy' formatına çevirir.
* Örn: '1987-04-08T14:35:00Z' -> '14:35, 08.04.1987'
*/
export function formatFromApiDate(isoStr?: string | null): string {
if (!isoStr) return "";
const trimmed = isoStr.trim();
if (!trimmed) return "";
if (/^\d{4}-\d{2}-\d{2}/.test(trimmed)) {
return trimmed.slice(0, 10);
const d = new Date(trimmed);
if (isNaN(d.getTime())) return trimmed;
const hours = d.getUTCHours();
const minutes = d.getUTCMinutes();
const day = String(d.getUTCDate()).padStart(2, "0");
const month = String(d.getUTCMonth() + 1).padStart(2, "0");
const year = d.getUTCFullYear();
const dateStr = `${day}.${month}.${year}`;
if (hours === 0 && minutes === 0) {
return dateStr;
}
return trimmed;
return `${String(hours).padStart(2, "0")}:${String(minutes).padStart(2, "0")}, ${dateStr}`;
}

View File

@@ -13,6 +13,7 @@ import { CreateButton } from "@/components/createButton";
import { StatusBadge, type StatusBadgeVariant } from "@/components/ui/statusBadge";
import { useBackups, useCreateBackup, useDeleteBackup, useDownloadBackup } from "@/features/backups/hooks/useBackups";
import type { Backup, BackupStatus } from "@/features/backups/api/backupsApi";
import { formatFromApiDate } from "@/lib/utils";
// ─── Status Badge ─────────────────────────────────────────────────────────────
@@ -144,7 +145,7 @@ export default function BackupsPage() {
accessorKey: "createdAt",
header: t("backups.col.createdAt", "Döredilen wagty"),
cell: ({ row }) => (
<span className="text-sm text-muted-foreground whitespace-nowrap">{new Date(row.original.createdAt).toLocaleString()}</span>
<span className="text-sm text-muted-foreground whitespace-nowrap">{formatFromApiDate(row.original.createdAt)}</span>
),
size: 180,
},

View File

@@ -18,6 +18,7 @@ import { useBackup, useDeleteBackup, useDownloadBackup } from "@/features/backup
import { InfoRow } from "@/components/viewPageComponents";
import { StatusBadge, type StatusBadgeVariant } from "@/components/ui/statusBadge";
import type { BackupStatus } from "@/features/backups/api/backupsApi";
import { formatFromApiDate } from "@/lib/utils";
// ─── Status Badge ─────────────────────────────────────────────────────────────
@@ -116,8 +117,8 @@ export default function BackupViewPage() {
isLink
href={data.createdBy?.id != null ? `/all-users/${data.createdBy.id}` : undefined}
/>
<InfoRow label={t("backups.col.createdAt", "Döredilen wagty")} value={new Date(data.createdAt).toLocaleString()} />
<InfoRow label={t("Updated at", "Täzelenen wagty")} value={new Date(data.updatedAt).toLocaleString()} />
<InfoRow label={t("backups.col.createdAt", "Döredilen wagty")} value={formatFromApiDate(data.createdAt)} />
<InfoRow label={t("Updated at", "Täzelenen wagty")} value={formatFromApiDate(data.updatedAt)} />
</div>
{/* Delete dialog */}

View File

@@ -14,7 +14,7 @@ import { DeleteDialog } from "@/components/deleteDialog";
import { useCardBalances, useDeleteCardBalance } from "@/features/cardBalance/hooks/useCardBalance";
import type { CardBalance, CardBalanceStatus } from "@/features/cardBalance/api/cardBalanceApi";
import { useInfiniteUsers } from "@/features/allUsers/hooks/useAllUsers";
import { formatFromApiDate } from "@/lib/utils";
// ─── Status Badge ─────────────────────────────────────────────────────────────
const STATUS_CONFIG: Record<
@@ -192,7 +192,7 @@ export default function CardBalancesPage() {
accessorKey: "createdAt",
header: t("Created at", "DÖREDILEN WAGTY"),
cell: ({ row }) => (
<span className="text-muted-foreground text-sm whitespace-nowrap">{new Date(row.original.createdAt).toLocaleString()}</span>
<span className="text-muted-foreground text-sm whitespace-nowrap">{formatFromApiDate(row.original.createdAt)}</span>
),
size: 180,
},

View File

@@ -18,7 +18,7 @@ import { useCardBalance, useDeleteCardBalance } from "@/features/cardBalance/hoo
import { InfoRow } from "@/components/viewPageComponents";
import { StatusBadge, type StatusBadgeVariant } from "@/components/ui/statusBadge";
import type { CardBalanceStatus } from "@/features/cardBalance/api/cardBalanceApi";
import { formatFromApiDate } from "@/lib/utils";
// ─── Status Badge ─────────────────────────────────────────────────────────────
const STATUS_CONFIG: Record<
@@ -109,15 +109,15 @@ export default function CardBalanceViewPage() {
<InfoRow label={t("Status", "Status")}>
<CardBalanceStatusBadge status={data.status} />
</InfoRow>
<InfoRow label={t("Checked at", "Barlan wagty")} value={new Date(data.checkedAt).toLocaleString()} />
<InfoRow label={t("Checked at", "Barlan wagty")} value={formatFromApiDate(data.checkedAt)} />
<InfoRow
label={t("Created by", "Döreden")}
value={data.createdBy?.name || data.createdBy?.username || undefined}
isLink
href={data.createdBy?.id != null ? `/all-users/${data.createdBy.id}` : undefined}
/>
<InfoRow label={t("Created at", "Döredilen wagty")} value={new Date(data.createdAt).toLocaleString()} />
<InfoRow label={t("Updated at", "Täzelenen wagty")} value={new Date(data.updatedAt).toLocaleString()} />
<InfoRow label={t("Created at", "Döredilen wagty")} value={formatFromApiDate(data.createdAt)} />
<InfoRow label={t("Updated at", "Täzelenen wagty")} value={formatFromApiDate(data.updatedAt)} />
</div>
{/* Delete dialog */}

View File

@@ -18,7 +18,7 @@ import { useBranches } from "@/features/branches/hooks/useBranches";
import { useDistricts } from "@/features/districts/hooks/useDistricts";
import { useCardTypes } from "@/features/cardTypes/hooks/useCardTypes";
import { getStatusLabel, getStatusOptions, isStatusValue, STATUS_BADGE_VARIANTS, type StatusValue } from "@/constants";
import { formatFromApiDate } from "@/lib/utils";
// ─── Filter field IDs ──────────────────────────────────────────────────────────
const FILTER_IDS = ["status", "branch_id", "user_id", "card_type_id", "region"] as const;
@@ -152,7 +152,7 @@ export default function CardPinsPage() {
header: t("cardPin.col.createdAt", "Döredilen wagty"),
cell: ({ row }) => (
<span className="text-sm text-muted-foreground whitespace-nowrap">
{row.original.createdAt ? new Date(row.original.createdAt).toLocaleString() : "—"}
{row.original.createdAt ? formatFromApiDate(row.original.createdAt) : "—"}
</span>
),
size: 180,

View File

@@ -18,9 +18,10 @@ import {
AlertDialogTitle,
AlertDialogTrigger,
} from "@/components/ui/alert-dialog";
import { BentoGrid, BentoCard, InfoRow } from "@/components/viewPageComponents";
import { BentoGrid, BentoCard, InfoRow, PassportImage } from "@/components/viewPageComponents";
import { getStatusLabel, isStatusValue, STATUS_BADGE_VARIANTS, type StatusValue } from "@/constants";
import type { LocalizedText } from "@/features/branches/api/branchesApi";
import { formatFromApiDate } from "@/lib/utils";
// ─── Helpers ──────────────────────────────────────────────────────────────────
@@ -95,8 +96,6 @@ export default function CardPinViewPage() {
return <div className="flex items-center justify-center py-24 text-muted-foreground">{t("common.notFound", "Maglumat tapylmady")}</div>;
}
const fmtDate = (v?: string | null) => (v ? new Date(v).toLocaleDateString() : "—");
return (
<div className="mx-auto flex flex-col gap-6">
{/* ── Page header ──────────────────────────────────────────────────── */}
@@ -155,10 +154,7 @@ export default function CardPinViewPage() {
<CardPinStatusBadge status={data.status} />
</InfoRow>
<InfoRow label={t("cardPin.field.notes", "Bellik")} value={data.notes || undefined} />
<InfoRow
label={t("cardPin.col.createdAt", "Döredilen wagty")}
value={data.createdAt ? new Date(data.createdAt).toLocaleString() : "—"}
/>
<InfoRow label={t("cardPin.col.createdAt", "Döredilen wagty")} value={data.createdAt ? formatFromApiDate(data.createdAt) : "—"} />
</BentoCard>
<BentoCard title={t("cardPin.cardSection", "Kart")}>
@@ -195,17 +191,29 @@ export default function CardPinViewPage() {
label={t("cardPin.fullName", "Doly ady")}
value={`${data.customerSurname} ${data.customerName} ${data.customerPatronicName ?? ""}`.trim()}
/>
<InfoRow label={t("cardPin.field.bornAt", "Doglan güni")} value={fmtDate(data.bornAt)} />
<InfoRow label={t("cardPin.field.bornAt", "Doglan güni")} value={formatFromApiDate(data.bornAt)} />
<InfoRow label={t("cardPin.field.phone", "Telefon")} value={data.phone} />
</BentoCard>
<BentoCard title={t("cardPin.passportSection", "Pasport")}>
<InfoRow label={t("cardPin.field.passportSerie", "Pasport seriýasy")} value={data.passportSerie} />
<InfoRow label={t("cardPin.field.passportId", "Pasport belgisi")} value={data.passportId} />
<InfoRow label={t("cardPin.field.passportOne", "Pasport 1")} value={data.passportOne || "—"} />
<InfoRow label={t("cardPin.field.passportTwo", "Pasport 2")} value={data.passportTwo || "—"} />
<InfoRow label={t("cardPin.field.passportThree", "Pasport 3")} value={data.passportThree || "—"} />
<InfoRow label={t("cardPin.field.passportFour", "Pasport 4")} value={data.passportFour || "—"} />
</BentoCard>
</BentoGrid>
{/* ── Row 3: Pasport suratlary ──────────────────────────────────────── */}
<BentoGrid cols={4}>
<BentoCard title={t("cardPin.field.passportOne", "Pasport 1")}>
<PassportImage label={t("cardPin.field.passportOne", "Pasport 1")} src={data.passportOne || undefined} />
</BentoCard>
<BentoCard title={t("cardPin.field.passportTwo", "Pasport 2")}>
<PassportImage label={t("cardPin.field.passportTwo", "Pasport 2")} src={data.passportTwo || undefined} />
</BentoCard>
<BentoCard title={t("cardPin.field.passportThree", "Pasport 3")}>
<PassportImage label={t("cardPin.field.passportThree", "Pasport 3")} src={data.passportThree || undefined} />
</BentoCard>
<BentoCard title={t("cardPin.field.passportFour", "Pasport 4")}>
<PassportImage label={t("cardPin.field.passportFour", "Pasport 4")} src={data.passportFour || undefined} />
</BentoCard>
</BentoGrid>
</div>

View File

@@ -20,6 +20,7 @@ import { resolveLocalizedName } from "@/features/cardRequisites/api/cardRequisit
import { StatusBadge, type StatusBadgeVariant } from "@/components/ui/statusBadge";
import { AlertCircle, CheckCircle2, XCircle } from "lucide-react";
import { BentoGrid, BentoCard, InfoRow, PassportImage } from "@/components/viewPageComponents";
import { formatFromApiDate } from "@/lib/utils";
// ─── Status config ────────────────────────────────────────────────────────────
@@ -64,13 +65,6 @@ function CardRequisiteViewSkeleton() {
);
}
function formatDate(value?: string): string {
if (!value) return "";
const d = new Date(value);
if (isNaN(d.getTime())) return value;
return d.toLocaleDateString();
}
// ─── Page ─────────────────────────────────────────────────────────────────────
export default function CardRequisiteViewPage() {
@@ -148,7 +142,7 @@ export default function CardRequisiteViewPage() {
<BentoCard title={t("cardRequisite.metaSection", "Esasy maglumatlar")}>
<InfoRow label={t("common.id", "ID")} value={data.id} />
<InfoRow label={t("Unique ID", "Unikal ID")} value={data.uniqueId || undefined} />
<InfoRow label={t("cardRequisite.createdAt", "Döredilen wagty")} value={new Date(data.createdAt).toLocaleString()} />
<InfoRow label={t("cardRequisite.createdAt", "Döredilen wagty")} value={formatFromApiDate(data.createdAt)} />
<InfoRow label={t("cardRequisite.status", "Status")}>
<CardRequisiteStatusBadge status={data.status} />
</InfoRow>
@@ -182,7 +176,7 @@ export default function CardRequisiteViewPage() {
<BentoGrid cols={2}>
<BentoCard title={t("cardRequisite.personalSection", "Şahsy maglumatlar")}>
<InfoRow label={t("cardRequisite.fullName", "Doly ady")} value={fullName} />
<InfoRow label={t("cardRequisite.birthDate", "Doglan güni")} value={formatDate(data.bornAt)} />
<InfoRow label={t("cardRequisite.birthDate", "Doglan güni")} value={formatFromApiDate(data.bornAt)} />
<InfoRow label={t("cardRequisite.phone", "Telefon")} value={data.phone} />
</BentoCard>

View File

@@ -10,6 +10,7 @@ import { TableActions } from "@/components/tableActions";
import type { VisibilityState } from "@tanstack/react-table";
import { useCardTransactions, useDeleteCardTransaction } from "@/features/cardTransactions/hooks/useCardTransactions";
import type { Card } from "@/features/cardTransactions/api/cardTransactionsApi";
import { formatFromApiDate } from "@/lib/utils";
// ─── Page ─────────────────────────────────────────────────────────────────────
@@ -103,7 +104,7 @@ export default function CardTransactionsPage() {
header: t("cardTransaction.col.createdAt", "Döredilen wagty"),
cell: ({ row }) => (
<span className="text-sm text-muted-foreground whitespace-nowrap">
{row.original.createdAt ? new Date(row.original.createdAt).toLocaleString() : "—"}
{row.original.createdAt ? formatFromApiDate(row.original.createdAt) : "—"}
</span>
),
size: 180,

View File

@@ -17,6 +17,7 @@ import {
import { useCardTransaction, useDeleteCardTransaction } from "@/features/cardTransactions/hooks/useCardTransactions";
import { BentoGrid, BentoCard, InfoRow } from "@/components/viewPageComponents";
import i18n from "@/lib/i18n";
import { formatFromApiDate } from "@/lib/utils";
// ─── Page ─────────────────────────────────────────────────────────────────────
@@ -106,11 +107,11 @@ export default function CardTransactionViewPage() {
/>
<InfoRow
label={t("cardTransaction.col.createdAt", "Döredilen wagty")}
value={data.createdAt ? new Date(data.createdAt).toLocaleString() : "—"}
value={data.createdAt ? formatFromApiDate(data.createdAt) : "—"}
/>
<InfoRow
label={t("cardTransaction.col.updatedAt", "Täzelenen wagty")}
value={data.updatedAt ? new Date(data.updatedAt).toLocaleString() : "—"}
value={data.updatedAt ? formatFromApiDate(data.updatedAt) : "—"}
/>
</BentoCard>
</BentoGrid>

View File

@@ -18,6 +18,7 @@ import { useInfiniteBranches } from "@/features/branches/hooks/useBranches";
import { useInfiniteDistricts } from "@/features/districts/hooks/useDistricts";
import { useInfiniteCardTypes } from "@/features/cardTypes/hooks/useCardTypes";
import { getStatusLabel, getStatusOptions, isStatusValue, STATUS_BADGE_VARIANTS, type StatusValue } from "@/constants";
import { formatFromApiDate } from "@/lib/utils/dateUtils";
const PER_PAGE = 25;
@@ -176,7 +177,7 @@ export default function CardOrdersPage() {
header: t("cardOrder.col.createdAt", "Döredilen wagty"),
cell: ({ row }) => (
<span className="text-sm text-muted-foreground whitespace-nowrap">
{row.original.createdAt ? new Date(row.original.createdAt).toLocaleString() : "—"}
{row.original.createdAt ? formatFromApiDate(row.original.createdAt) : "—"}
</span>
),
size: 180,

View File

@@ -20,6 +20,7 @@ import { StatusBadge, type StatusBadgeVariant } from "@/components/ui/statusBadg
import { AlertCircle, CheckCircle2, XCircle, CheckCheck } from "lucide-react";
import { getStatusLabel, isStatusValue, STATUS_BADGE_VARIANTS, type StatusValue } from "@/constants";
import type { LocalizedText } from "@/features/branches/api/branchesApi";
import { formatFromApiDate } from "@/lib/utils";
// ─── Helpers ──────────────────────────────────────────────────────────────────
@@ -96,8 +97,6 @@ export default function CardOrderDetailPage() {
if (isLoading) return <DetailSkeleton />;
if (!order) return <p className="text-muted-foreground text-sm">{t("common.notFound", "Tapylmady")}</p>;
const fmtDate = (v?: string | null) => (v ? new Date(v).toLocaleDateString() : "—");
return (
<div className="flex flex-col gap-6">
{/* ── Page header ──────────────────────────────────────────────────── */}
@@ -149,7 +148,7 @@ export default function CardOrderDetailPage() {
<InfoRow label={t("cardOrder.field.notes", "Bellik")} value={order.notes ?? undefined} />
<InfoRow
label={t("cardOrder.field.createdAt", "Döredilen wagty")}
value={order.createdAt ? new Date(order.createdAt).toLocaleString() : "—"}
value={order.createdAt ? formatFromApiDate(order.createdAt) : "—"}
/>
</BentoCard>
@@ -188,7 +187,7 @@ export default function CardOrderDetailPage() {
label={t("cardOrder.field.fullName", "Doly ady")}
value={[order.customerSurname, order.customerName, order.customerPatronicName].filter(Boolean).join(" ")}
/>
<InfoRow label={t("cardOrder.field.bornAt", "Doglan güni")} value={fmtDate(order.bornAt)} />
<InfoRow label={t("cardOrder.field.bornAt", "Doglan güni")} value={formatFromApiDate(order.bornAt)} />
<InfoRow label={t("cardOrder.field.bornPlace", "Doglan ýeri")} value={order.bornPlace ?? undefined} />
<InfoRow label={t("cardOrder.field.oldSurname", "Köne familiýa")} value={order.oldSurname ?? undefined} />
<InfoRow label={t("cardOrder.field.citizenship", "Raýatlyk")} value={order.citizenship} />
@@ -207,7 +206,7 @@ export default function CardOrderDetailPage() {
<BentoCard title={t("cardOrder.section.passport", "Pasport")}>
<InfoRow label={t("cardOrder.field.passportSerie", "Pasport seriýasy")} value={order.passportSerie} />
<InfoRow label={t("cardOrder.field.passportId", "Pasport belgisi")} value={order.passportId} />
<InfoRow label={t("cardOrder.field.passportGivenAt", "Berlen senesi")} value={fmtDate(order.passportGivenAt)} />
<InfoRow label={t("cardOrder.field.passportGivenAt", "Berlen senesi")} value={formatFromApiDate(order.passportGivenAt)} />
<InfoRow label={t("cardOrder.field.passportGivenBy", "Beren edara")} value={order.passportGivenBy ?? undefined} />
<InfoRow label={t("cardOrder.field.passportAddress", "Pasport salgysy")} value={order.passportAddress ?? undefined} />
</BentoCard>

View File

@@ -11,6 +11,7 @@ import { TableActions } from "@/components/tableActions";
import { DeleteDialog } from "@/components/deleteDialog";
import { useGetCurrencyRates, useDeleteCurrencyRate } from "@/features/currencyRates/hooks/useCurrencyRates";
import { CURRENCY_OPTIONS, type CurrencyRate } from "@/features/currencyRates/api/currencyRatesApi";
import { formatFromApiDate } from "@/lib/utils";
// ─── Column meta for toggle dropdown ─────────────────────────────────────────
@@ -125,7 +126,7 @@ export default function CurrencyRatesPage() {
accessorKey: "createdAt",
header: t("Created at", "DÖREDILEN WAGTY"),
cell: ({ row }) => (
<span className="text-sm text-muted-foreground whitespace-nowrap">{new Date(row.original.createdAt).toLocaleString()}</span>
<span className="text-sm text-muted-foreground whitespace-nowrap">{formatFromApiDate(row.original.createdAt)}</span>
),
size: 180,
},

View File

@@ -9,6 +9,7 @@ import { Skeleton } from "@/components/ui/skeleton";
import { Section, InfoRow } from "@/components/viewPageComponents";
import { useGetCurrencyRateById, useDeleteCurrencyRate } from "@/features/currencyRates/hooks/useCurrencyRates";
import { ConfirmDialog } from "@/components/confirmDialog";
import { formatFromApiDate } from "@/lib/utils";
// ─── CurrencyRateDetailPage ───────────────────────────────────────────────────
@@ -96,8 +97,8 @@ export default function CurrencyRateDetailPage() {
isLink
href={rate.updatedBy?.id != null ? `/all-users/${rate.updatedBy.id}` : undefined}
/>
<InfoRow label={t("common.createdAt", "Döredilen senesi")} value={new Date(rate.createdAt).toLocaleString()} />
<InfoRow label={t("common.updatedAt", "Üýtgedilen senesi")} value={new Date(rate.updatedAt).toLocaleString()} />
<InfoRow label={t("common.createdAt", "Döredilen senesi")} value={formatFromApiDate(rate.createdAt)} />
<InfoRow label={t("common.updatedAt", "Üýtgedilen senesi")} value={formatFromApiDate(rate.updatedAt)} />
</Section>
<ConfirmDialog

View File

@@ -18,6 +18,7 @@ import { useInfiniteBranches } from "@/features/shared/hooks/useSharedBranchUser
import { useInfiniteUsers } from "@/features/allUsers/hooks/useAllUsers";
import type { LocalizedText } from "@/features/branches/api/branchesApi";
import { REGION_CODES, REGION_LABELS } from "@/constants";
import { formatFromApiDate } from "@/lib/utils/dateUtils";
// ─── Constants ────────────────────────────────────────────────────────────────
@@ -105,7 +106,9 @@ export default function IntlPaymentsPage() {
{
accessorKey: "created_at",
header: t("intlPayment.createdAt", "Döredilen wagty"),
cell: ({ row }) => <span className="text-sm text-muted-foreground whitespace-nowrap">{row.original.created_at}</span>,
cell: ({ row }) => (
<span className="text-sm text-muted-foreground whitespace-nowrap">{formatFromApiDate(row.original.created_at)}</span>
),
},
{
accessorKey: "province_label",

View File

@@ -8,6 +8,7 @@ import { StatusBadge, type StatusBadgeVariant } from "@/components/ui/statusBadg
import { BentoGrid, BentoCard, InfoRow } from "@/components/viewPageComponents";
import { useIntlPayment, useDeleteIntlPayment } from "@/features/visaMasterPayments/hooks/useVisaMasterPayments";
import type { IntlPaymentStatus } from "@/features/visaMasterPayments/api/visaMasterPaymentsApi";
import { formatFromApiDate } from "@/lib/utils/dateUtils";
// ─── Status config ────────────────────────────────────────────────────────────
@@ -201,7 +202,7 @@ export default function IntlPaymentViewPage() {
<InfoRow label={t("intlPayment.status", "Status")}>
<PaymentStatusBadge status={data.status} />
</InfoRow>
<InfoRow label={t("intlPayment.tilowanMonth", "Tölewan (Aý/aý)")} value={data.created_at} />
<InfoRow label={t("intlPayment.tilowanMonth", "Tölewan (Aý/aý)")} value={formatFromApiDate(data.created_at)} />
<InfoRow label={t("intlPayment.note", "Bellik")} value={data.note} />
</BentoCard>

View File

@@ -8,6 +8,7 @@ import { DataTableToolbar, type ColumnMeta } from "@/components/dataTableToolbar
import { useActivityLogs } from "@/features/activityLogs/hooks/useActivityLogs";
import type { ActivityLog } from "@/features/activityLogs/api/activityLogsApi";
import type { VisibilityState } from "@tanstack/react-table";
import { formatFromApiDate } from "@/lib/utils";
const MODULE_OPTIONS = [
"loan-orders",
@@ -135,7 +136,7 @@ export default function ActivityLogsPage() {
{
accessorKey: "createdAt",
header: t("logs.fields.createdAt", "Wagty"),
cell: ({ row }) => <span className="text-sm text-muted-foreground">{new Date(row.original.createdAt).toLocaleString()}</span>,
cell: ({ row }) => <span className="text-sm text-muted-foreground">{formatFromApiDate(row.original.createdAt)}</span>,
size: 170,
},
{

View File

@@ -6,6 +6,7 @@ import { Button } from "@/components/ui/button";
import { Separator } from "@/components/ui/separator";
import { Spinner } from "@/components/ui/spinner";
import { useActivityLog } from "@/features/activityLogs/hooks/useActivityLogs";
import { formatFromApiDate } from "@/lib/utils";
export default function ActivityLogViewPage() {
const { t } = useTranslation();
@@ -115,7 +116,7 @@ export default function ActivityLogViewPage() {
<Separator />
<div className="flex justify-between">
<span className="text-sm text-muted-foreground">{t("logs.fields.createdAt", "Wagty")}</span>
<span className="text-sm">{new Date(log.createdAt).toLocaleString()}</span>
<span className="text-sm">{formatFromApiDate(log.createdAt)}</span>
</div>
</CardContent>
</Card>