mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-25 14:28:51 +08:00
28 lines
660 B
TypeScript
28 lines
660 B
TypeScript
import localizedFormat from 'dayjs/plugin/localizedFormat';
|
|
import dayjs from 'dayjs';
|
|
import { PageMeta } from '@/providers/app-state-provider';
|
|
import { TableCell } from '@/ui/table';
|
|
import React from 'react';
|
|
|
|
dayjs.extend(localizedFormat);
|
|
|
|
export const DateCell = ({
|
|
pageMeta,
|
|
dateKey,
|
|
backupKey = '',
|
|
}: {
|
|
pageMeta: PageMeta;
|
|
dateKey: keyof PageMeta;
|
|
backupKey?: keyof PageMeta;
|
|
}) => {
|
|
// dayjs().format('L LT');
|
|
const value = pageMeta[dateKey] ?? pageMeta[backupKey];
|
|
return (
|
|
<TableCell ellipsis={true}>
|
|
{value ? dayjs(value as string).format('YYYY-MM-DD HH:mm') : '--'}
|
|
</TableCell>
|
|
);
|
|
};
|
|
|
|
export default DateCell;
|