mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Add common DateTimeCell for tables
This commit is contained in:
parent
bd92527529
commit
5262c9bee6
5 changed files with 35 additions and 15 deletions
17
src/apps/dashboard/components/table/DateTimeCell.tsx
Normal file
17
src/apps/dashboard/components/table/DateTimeCell.tsx
Normal file
|
@ -0,0 +1,17 @@
|
|||
import format from 'date-fns/format';
|
||||
import type { MRT_Cell, MRT_RowData } from 'material-react-table';
|
||||
import { FC } from 'react';
|
||||
|
||||
import { useLocale } from 'hooks/useLocale';
|
||||
|
||||
interface CellProps {
|
||||
cell: MRT_Cell<MRT_RowData>
|
||||
}
|
||||
|
||||
const DateTimeCell: FC<CellProps> = ({ cell }) => {
|
||||
const { dateFnsLocale } = useLocale();
|
||||
|
||||
return format(cell.getValue<Date>(), 'Pp', { locale: dateFnsLocale });
|
||||
};
|
||||
|
||||
export default DateTimeCell;
|
Loading…
Add table
Add a link
Reference in a new issue