diff --git a/frontend/src/component/common/Table/cells/TimeAgoCell/TimeAgoCell.tsx b/frontend/src/component/common/Table/cells/TimeAgoCell/TimeAgoCell.tsx index 5e339dba2c..8c45180f5d 100644 --- a/frontend/src/component/common/Table/cells/TimeAgoCell/TimeAgoCell.tsx +++ b/frontend/src/component/common/Table/cells/TimeAgoCell/TimeAgoCell.tsx @@ -1,7 +1,7 @@ import { Tooltip, Typography } from '@mui/material'; import { useLocationSettings } from 'hooks/useLocationSettings'; import { VFC } from 'react'; -import { formatDateYMD, formatDateYMDHMS } from 'utils/formatDate'; +import { formatDateYMD } from 'utils/formatDate'; import { TextCell } from '../TextCell/TextCell'; import TimeAgo from 'react-timeago'; @@ -10,7 +10,7 @@ interface ITimeAgoCellProps { live?: boolean; emptyText?: string; title?: (date: string) => string; - timestamp?: boolean; + dateFormat?: (value: string | number | Date, locale: string) => string; } export const TimeAgoCell: VFC = ({ @@ -18,15 +18,13 @@ export const TimeAgoCell: VFC = ({ live = false, emptyText, title, - timestamp, + dateFormat = formatDateYMD, }) => { const { locationSettings } = useLocationSettings(); if (!value) return {emptyText}; - const date = timestamp - ? formatDateYMDHMS(value, locationSettings.locale) - : formatDateYMD(value, locationSettings.locale); + const date = dateFormat(value, locationSettings.locale); return ( diff --git a/frontend/src/component/signOnLog/SignOnLogTable/SignOnLogTable.tsx b/frontend/src/component/signOnLog/SignOnLogTable/SignOnLogTable.tsx index 9d13685334..8a498b8a9c 100644 --- a/frontend/src/component/signOnLog/SignOnLogTable/SignOnLogTable.tsx +++ b/frontend/src/component/signOnLog/SignOnLogTable/SignOnLogTable.tsx @@ -22,6 +22,7 @@ import { ISignOnEvent } from 'interfaces/signOnEvent'; import { SignOnLogActionsCell } from './SignOnLogActionsCell/SignOnLogActionsCell'; import { SignOnLogDeleteDialog } from './SignOnLogDeleteDialog/SignOnLogDeleteDialog'; import { useSignOnLogApi } from 'hooks/api/actions/useSignOnLogApi/useSignOnLogApi'; +import { formatDateYMDHMS } from 'utils/formatDate'; export const SignOnLogTable = () => { const { setToastData, setToastApiError } = useToast(); @@ -56,7 +57,7 @@ export const SignOnLogTable = () => { Header: 'Created', accessor: 'created_at', Cell: ({ value }: { value: Date }) => ( - + ), sortType: 'date', maxWidth: 150,