mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-20 11:35:29 +01:00
Fix #391 - relative timestamps now contain an exact datetime in title
This commit is contained in:
parent
2b0b7ff1b8
commit
98b83aca37
@ -1,15 +1,18 @@
|
||||
import {
|
||||
FormattedMessage,
|
||||
FormattedDate,
|
||||
FormattedRelative
|
||||
} from 'react-intl';
|
||||
import { injectIntl, FormattedRelative } from 'react-intl';
|
||||
|
||||
const RelativeTimestamp = ({ timestamp }) => {
|
||||
return <FormattedRelative value={new Date(timestamp)} />;
|
||||
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 RelativeTimestamp;
|
||||
export default injectIntl(RelativeTimestamp);
|
||||
|
Loading…
Reference in New Issue
Block a user