mirror of
https://github.com/glitch-soc/mastodon.git
synced 2024-11-16 21:24:18 -05:00
2e112e2406
* Add semi to ESLint rules * Add padded-blocks to ESLint rules * Add comma-dangle to ESLint rules * add config/webpack and storyboard * add streaming/ * yarn test:lint -- --fix
21 lines
614 B
JavaScript
21 lines
614 B
JavaScript
import React from 'react';
|
|
import { injectIntl, FormattedRelative } from 'react-intl';
|
|
import PropTypes from 'prop-types';
|
|
|
|
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: PropTypes.object.isRequired,
|
|
timestamp: PropTypes.string.isRequired,
|
|
};
|
|
|
|
export default injectIntl(RelativeTimestamp);
|