refactor: improve server list update at display

This commit is contained in:
moonrailgun 2024-05-02 01:25:55 +08:00
parent 7cfafe49d7
commit 51675f6129
2 changed files with 3 additions and 1 deletions

View File

@ -136,7 +136,7 @@ export const ServerList: React.FC<ServerListProps> = React.memo((props) => {
columnHelper.accessor('updatedAt', { columnHelper.accessor('updatedAt', {
header: t('updatedAt'), header: t('updatedAt'),
size: 130, size: 130,
cell: (props) => dayjs(props.getValue()).format('MMM D HH:mm:ss'), cell: (props) => dayjs(props.getValue()).fromNow(),
}), }),
]; ];
}, [t]); }, [t]);

View File

@ -1,11 +1,13 @@
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc'; import utc from 'dayjs/plugin/utc';
import timezone from 'dayjs/plugin/timezone'; import timezone from 'dayjs/plugin/timezone';
import relativeTime from 'dayjs/plugin/relativeTime';
import advancedFormat from 'dayjs/plugin/advancedFormat'; import advancedFormat from 'dayjs/plugin/advancedFormat';
import type { DateUnit } from '@tianji/shared'; import type { DateUnit } from '@tianji/shared';
dayjs.extend(utc); dayjs.extend(utc);
dayjs.extend(timezone); dayjs.extend(timezone);
dayjs.extend(relativeTime);
dayjs.extend(advancedFormat); dayjs.extend(advancedFormat);
export type { DateUnit }; export type { DateUnit };