aboutsummaryrefslogblamecommitdiffstats
path: root/webui/src/components/Date.tsx
blob: 1454fac77bdbbb7d51fcaee9d71d353ae101f0d2 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
                                                    
                            




                                  
 

                                   
                                               


                                                                
            
  
 
                    
import Tooltip from '@mui/material/Tooltip/Tooltip';
import moment from 'moment';
import Moment from 'react-moment';

const HOUR = 1000 * 3600;
const DAY = 24 * HOUR;
const WEEK = 7 * DAY;

type Props = { date: string };
const Date = ({ date }: Props) => (
  <Tooltip title={moment(date).format('LLLL')}>
    <span>
      <Moment date={date} format="on ll" fromNowDuring={WEEK} />
    </span>
  </Tooltip>
);

export default Date;