import React from 'react' ; import { EuiToolTip } from '@elastic/eui' ; import moment from 'moment-timezone' ; import { asAbsoluteDateTime , TimeUnit , } from '../../../../common/utils/formatters' ; interface Props { /**
     * timestamp in milliseconds or ISO timestamp
     */ time : number | string ; timeUnit ? : TimeUnit ; } export function TimestampTooltip ( { time , timeUnit = 'milliseconds' } ) { const momentTime = moment ( time ) ; const relativeTimeLabel = momentTime . fromNow ( ) ; const absoluteTimeLabel = asAbsoluteDateTime ( time , timeUnit ) ; return ( < EuiToolTip content = { absoluteTimeLabel } > < > { relativeTimeLabel } < /> < /EuiToolTip>); }