Skip to content

Commit

Permalink
fix date format error
Browse files Browse the repository at this point in the history
  • Loading branch information
KMKoushik committed Nov 1, 2024
1 parent c472b47 commit e728303
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions src/pages/groups/[groupId].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ const BalancePage: NextPageWithUser<{
);
}

console.log('expensesQuery.data', expensesQuery.data);

return (
<>
<Head>
Expand Down Expand Up @@ -167,12 +169,12 @@ const BalancePage: NextPageWithUser<{
<div className="mt-8">
<p className="font-semibold">First expense</p>
<p>
{format(
new Date(
expensesQuery.data[expensesQuery.data.length - 1]?.createdAt ?? '',
).toLocaleDateString(),
'yyyy-MM-dd',
)}
{expensesQuery.data[expensesQuery.data.length - 1]?.createdAt
? format(
expensesQuery.data[expensesQuery.data.length - 1]!.createdAt,
'MMM dd, yyyy',
)
: '--'}
</p>
</div>
)}
Expand Down Expand Up @@ -200,12 +202,7 @@ const BalancePage: NextPageWithUser<{
{groupDetailQuery?.data?.createdAt && (
<div className="mt-8">
<p className="font-semibold ">Group created</p>
<p>
{format(
new Date(groupDetailQuery.data?.createdAt).toLocaleDateString(),
'yyyy-MM-dd',
)}
</p>
<p>{format(groupDetailQuery.data?.createdAt, 'MMM dd, yyyy')}</p>
</div>
)}
<div className="mt-8">
Expand Down

0 comments on commit e728303

Please sign in to comment.