11/* eslint-disable @typescript-eslint/no-explicit-any */
22import _ from 'lodash' ;
3- import moment from 'moment' ;
43import { MUIDataTableColumn } from 'mui-datatables' ;
54import { useCallback , useMemo , useRef } from 'react' ;
65import { PublishIcon } from '../../icons' ;
76import { CHARCOAL } from '../../theme' ;
7+ import { FormattedTime } from '../../utils' ;
88import { Pattern } from '../CustomCatalog/CustomCard' ;
9- import { CustomTooltip } from '../CustomTooltip' ;
109import { ErrorBoundary } from '../ErrorBoundary' ;
1110import { ColView } from '../Helpers/ResponsiveColumns/responsive-coulmns.tsx/responsive-column' ;
1211import PromptComponent from '../Prompt' ;
@@ -58,10 +57,6 @@ export const CatalogDesignsTable: React.FC<CatalogDesignsTableProps> = ({
5857} ) => {
5958 const modalRef = useRef < PromptRef > ( null ) ;
6059
61- const formatDate = useCallback ( ( date : string | Date ) : string => {
62- return moment ( date ) . fromNow ( ) ;
63- } , [ ] ) ;
64-
6560 const processedColumns : MUIDataTableColumn [ ] = useMemo ( ( ) => {
6661 return columns . map ( ( col ) => {
6762 const newCol = { ...col } ;
@@ -82,25 +77,16 @@ export const CatalogDesignsTable: React.FC<CatalogDesignsTableProps> = ({
8277 if ( ! value || value === 'NA' ) return < > NA</ > ;
8378 if ( typeof value === 'object' && 'Valid' in value ) {
8479 if ( value . Valid && value . Time ) {
85- const date = new Date ( value . Time ) ;
86- return (
87- < CustomTooltip title = { date . toString ( ) } disableInteractive >
88- < div > { formatDate ( date ) } </ div >
89- </ CustomTooltip >
90- ) ;
80+ return < FormattedTime date = { value . Time } /> ;
9181 }
9282 return < > NA</ > ;
9383 }
94- return (
95- < CustomTooltip title = { new Date ( value ) . toString ( ) } disableInteractive >
96- < div > { formatDate ( value ) } </ div >
97- </ CustomTooltip >
98- ) ;
84+ return < FormattedTime date = { value . Time } /> ;
9985 } ;
10086 }
10187 return newCol ;
10288 } ) ;
103- } , [ columns , columnVisibility , formatDate ] ) ;
89+ } , [ columns , columnVisibility ] ) ;
10490
10591 const handleTableChange = useCallback (
10692 ( action : string , tableState : any ) => {
0 commit comments