Skip to content

Commit 152c8bc

Browse files
committed
update date format
1 parent e995dea commit 152c8bc

File tree

2 files changed

+15
-22
lines changed

2 files changed

+15
-22
lines changed

app/[locale]/dashboard/[entityType]/[entitySlug]/dataset/page.tsx

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { Loading } from '@/components/loading';
1414
import { ActionBar } from './components/action-bar';
1515
import { Content } from './components/content';
1616
import { Navigation } from './components/navigate-org-datasets';
17+
import { formatDate } from '@/lib/utils';
1718

1819
const allDatasetsQueryDoc: any = graphql(`
1920
query allDatasetsQuery($filters: DatasetFilter, $order: DatasetOrder) {
@@ -239,16 +240,8 @@ export default function DatasetPage({
239240
return {
240241
title: item.title,
241242
id: item.id,
242-
created: new Date(item.created).toLocaleString('en-GB', {
243-
day: '2-digit',
244-
month: '2-digit',
245-
year: 'numeric',
246-
}),
247-
modified: new Date(item.modified).toLocaleString('en-GB', {
248-
day: '2-digit',
249-
month: '2-digit',
250-
year: 'numeric',
251-
}),
243+
created: formatDate(item.created),
244+
modified: formatDate(item.modified),
252245
};
253246
});
254247
};

app/[locale]/dashboard/[entityType]/[entitySlug]/usecases/page.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { Button, DataTable, Icon, IconButton, Text, toast } from 'opub-ui';
99
import { twMerge } from 'tailwind-merge';
1010

1111
import { GraphQL } from '@/lib/api';
12+
import { formatDate } from '@/lib/utils';
1213
import { Icons } from '@/components/icons';
1314
import { LinkButton } from '@/components/Link';
1415
import { Loading } from '@/components/loading';
@@ -184,14 +185,21 @@ export default function DatasetPage({
184185
header: 'Title',
185186
cell: ({ row }: any) =>
186187
navigationTab === 'published' ? (
187-
<Text className="line-clamp-1 max-w-[280px]" title={row.original.title}>{row.original.title}</Text>
188+
<Text
189+
className="line-clamp-1 max-w-[280px]"
190+
title={row.original.title}
191+
>
192+
{row.original.title}
193+
</Text>
188194
) : (
189195
<LinkButton
190196
kind="tertiary"
191197
size="medium"
192198
href={`/dashboard/${params.entityType}/${params.entitySlug}/usecases/edit/${row.original.id}/details`}
193199
>
194-
<span className="line-clamp-1 max-w-[280px]">{row.original.title}</span>
200+
<span className="line-clamp-1 max-w-[280px]">
201+
{row.original.title}
202+
</span>
195203
</LinkButton>
196204
),
197205
},
@@ -235,16 +243,8 @@ export default function DatasetPage({
235243
return {
236244
title: item.title,
237245
id: item.id,
238-
created: new Date(item.created).toLocaleString('en-GB', {
239-
day: '2-digit',
240-
month: '2-digit',
241-
year: 'numeric',
242-
}),
243-
modified: new Date(item.modified).toLocaleString('en-GB', {
244-
day: '2-digit',
245-
month: '2-digit',
246-
year: 'numeric',
247-
}),
246+
created: formatDate(item.created),
247+
modified: formatDate(item.modified),
248248
};
249249
});
250250
};

0 commit comments

Comments
 (0)