File size: 875 Bytes
f5071ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { Text } from '@chakra-ui/react';
import React from 'react';
import Moment from 'react-moment';
import {
   calTimeStamp,
   dateFormat,
   isLimitedDate,
} from '../../helper/calcTimestamp';

const DisplayDate = ({ createdAt, isUpdated, color }) => {
   return (
      <>
         <Text fontSize='12px' color={color}>
            {dateFormat(createdAt)}{' '}
            {!isLimitedDate(createdAt) && (
               <Text as='span'>
                  (<Moment fromNow>{calTimeStamp(createdAt)}</Moment>)
               </Text>
            )}{' '}
            {isUpdated && (
               <Text fontSize='11px' as='span'>
                  •{' '}
                  <Text as='span' rounded='sm' px='3px'>
                     Updated
                  </Text>
               </Text>
            )}
         </Text>
      </>
   );
};

export default DisplayDate;