mirror of
https://codeberg.org/MarkusThielker/finances.git
synced 2025-04-12 05:08:43 +00:00
N-FIN-7: fix date format
This commit is contained in:
parent
09c8e6f567
commit
9d899b29e0
2 changed files with 6 additions and 8 deletions
|
@ -3,6 +3,7 @@
|
||||||
import { ColumnDef } from '@tanstack/react-table';
|
import { ColumnDef } from '@tanstack/react-table';
|
||||||
import { Category } from '@prisma/client';
|
import { Category } from '@prisma/client';
|
||||||
import { CellContext, ColumnDefTemplate } from '@tanstack/table-core';
|
import { CellContext, ColumnDefTemplate } from '@tanstack/table-core';
|
||||||
|
import { format } from 'date-fns';
|
||||||
|
|
||||||
export const columns = (
|
export const columns = (
|
||||||
actionCell: ColumnDefTemplate<CellContext<Category, unknown>>,
|
actionCell: ColumnDefTemplate<CellContext<Category, unknown>>,
|
||||||
|
@ -29,16 +30,14 @@ export const columns = (
|
||||||
accessorKey: 'createdAt',
|
accessorKey: 'createdAt',
|
||||||
header: 'Created at',
|
header: 'Created at',
|
||||||
cell: ({row}) => {
|
cell: ({row}) => {
|
||||||
const date = row.getValue('createdAt') as Date;
|
return format(row.original.createdAt, 'PPP');
|
||||||
return date.toDateString();
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: 'updatedAt',
|
accessorKey: 'updatedAt',
|
||||||
header: 'Updated at',
|
header: 'Updated at',
|
||||||
cell: ({row}) => {
|
cell: ({row}) => {
|
||||||
const date = row.getValue('updatedAt') as Date;
|
return format(row.original.updatedAt, 'PPP');
|
||||||
return date.toDateString();
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
import { ColumnDef } from '@tanstack/react-table';
|
import { ColumnDef } from '@tanstack/react-table';
|
||||||
import { Entity } from '@prisma/client';
|
import { Entity } from '@prisma/client';
|
||||||
import { CellContext, ColumnDefTemplate } from '@tanstack/table-core';
|
import { CellContext, ColumnDefTemplate } from '@tanstack/table-core';
|
||||||
|
import { format } from 'date-fns';
|
||||||
|
|
||||||
export const columns = (
|
export const columns = (
|
||||||
actionCell: ColumnDefTemplate<CellContext<Entity, unknown>>,
|
actionCell: ColumnDefTemplate<CellContext<Entity, unknown>>,
|
||||||
|
@ -21,16 +22,14 @@ export const columns = (
|
||||||
accessorKey: 'createdAt',
|
accessorKey: 'createdAt',
|
||||||
header: 'Created at',
|
header: 'Created at',
|
||||||
cell: ({row}) => {
|
cell: ({row}) => {
|
||||||
const date = row.getValue('createdAt') as Date;
|
return format(row.original.createdAt, 'PPP');
|
||||||
return date.toDateString();
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: 'updatedAt',
|
accessorKey: 'updatedAt',
|
||||||
header: 'Updated at',
|
header: 'Updated at',
|
||||||
cell: ({row}) => {
|
cell: ({row}) => {
|
||||||
const date = row.getValue('updatedAt') as Date;
|
return format(row.original.updatedAt, 'PPP');
|
||||||
return date.toDateString();
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue