mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-30 23:49:04 +01:00
18 lines
562 B
JavaScript
18 lines
562 B
JavaScript
import { injectIntl, FormattedRelative } from 'react-intl';
|
|
|
|
const RelativeTimestamp = ({ intl, timestamp }) => {
|
|
const date = new Date(timestamp);
|
|
|
|
return (
|
|
<time dateTime={timestamp} title={intl.formatDate(date, { hour12: false, year: 'numeric', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' })}>
|
|
<FormattedRelative value={date} />
|
|
</time>
|
|
);
|
|
};
|
|
|
|
RelativeTimestamp.propTypes = {
|
|
intl: React.PropTypes.object.isRequired,
|
|
timestamp: React.PropTypes.string.isRequired
|
|
};
|
|
|
|
export default injectIntl(RelativeTimestamp);
|