Skip to content

Commit 807b1f7

Browse files
committed
format dates better
1 parent 992bb96 commit 807b1f7

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/ui/pages/stripe/CurrentLinks.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,19 @@ import {
99
Skeleton,
1010
Table,
1111
Title,
12+
Text,
1213
} from '@mantine/core';
1314
import { IconAlertCircle, IconAlertTriangle } from '@tabler/icons-react';
1415
import React, { useEffect, useState } from 'react';
1516
import { GetInvoiceLinksResponse } from '@common/types/stripe';
1617
import { notifications } from '@mantine/notifications';
1718
import { useAuth } from '@ui/components/AuthContext';
1819
import pluralize from 'pluralize';
20+
import dayjs from 'dayjs';
21+
22+
const HumanFriendlyDate = ({ date }: { date: string | Date }) => {
23+
return <Text size="sm">{dayjs(date).format('MMMM D, YYYY')}</Text>;
24+
};
1925

2026
interface StripeCurrentLinksPanelProps {
2127
getLinks: () => Promise<GetInvoiceLinksResponse>;
@@ -82,7 +88,9 @@ export const StripeCurrentLinksPanel: React.FC<StripeCurrentLinksPanelProps> = (
8288
<NumberFormatter prefix="$" value={data.invoiceAmountUsd / 100} thousandSeparator />
8389
</Table.Td>
8490
<Table.Td>{data.userId.replace(userData!.email!, 'You')}</Table.Td>
85-
<Table.Td>{data.createdAt === null ? 'Unknown' : data.createdAt}</Table.Td>
91+
<Table.Td>
92+
{data.createdAt === null ? 'Unknown' : HumanFriendlyDate({ date: data.createdAt })}
93+
</Table.Td>
8694
<Table.Td>
8795
<CopyButton value={data.link}>
8896
{({ copied, copy }) => (

0 commit comments

Comments
 (0)