Fix #391 - relative timestamps now contain an exact datetime in title

main
Eugen Rochko 8 years ago
parent 2b0b7ff1b8
commit 98b83aca37

@ -1,15 +1,18 @@
import { import { injectIntl, FormattedRelative } from 'react-intl';
FormattedMessage,
FormattedDate, const RelativeTimestamp = ({ intl, timestamp }) => {
FormattedRelative const date = new Date(timestamp);
} from 'react-intl';
return (
const RelativeTimestamp = ({ timestamp }) => { <time dateTime={timestamp} title={intl.formatDate(date, { hour12: false, year: 'numeric', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' })}>
return <FormattedRelative value={new Date(timestamp)} />; <FormattedRelative value={date} />
</time>
);
}; };
RelativeTimestamp.propTypes = { RelativeTimestamp.propTypes = {
intl: React.PropTypes.object.isRequired,
timestamp: React.PropTypes.string.isRequired timestamp: React.PropTypes.string.isRequired
}; };
export default RelativeTimestamp; export default injectIntl(RelativeTimestamp);

Loading…
Cancel
Save