import React , { Fragment } from 'react' ; import { FormattedDate , FormattedTime } from '@kbn/i18n-react' ; interface Props { epochMs : number ; type ? : 'date' | 'time' ; } export const FormattedDateTime = ( { epochMs , type } ) => { const date = new Date ( epochMs ) ; const formattedDate = < FormattedDate value = { date } year = "numeric" month = "short" day = "2-digit" / > ; const formattedTime = < FormattedTime value = { date } timeZoneName = "short" / > ; if ( type ) { return type === 'date' ? formattedDate : formattedTime ; } return ( < Fragment > { formattedDate } { formattedTime } < /Fragment>); } ;