import * as React from 'react' ; import { isPresent } from 'polar-shared/src/Preconditions' ; import Moment from 'react-moment' ; import { ISODateTimeString } from 'polar-shared/src/metadata/ISODateTimeStrings' ; interface IProps { readonly datetime : ISODateTimeString | null | undefined ; readonly className ? : string ; readonly style ? : React . CSSProperties ; } export const DateTimeTableCell = React . memo ( function DateTimeTableCell ( props ) { if ( isPresent ( props . datetime ) ) { return ( < Moment withTitle = { true } className = { props . className || '' } style = { { whiteSpace : 'nowrap' , userSelect : "none" , ... props . style } } titleFormat = "D MMM YYYY hh:MM A" fromNow ago > { props . datetime ! } < /Moment>); } else { return null ; } } ) ;