Add an Intl polyfill
This commit is contained in:
@@ -4,21 +4,12 @@ import {
|
||||
FormattedRelative
|
||||
} from 'react-intl';
|
||||
|
||||
const RelativeTimestamp = ({ timestamp, now }) => {
|
||||
const diff = (new Date(now)) - (new Date(timestamp));
|
||||
|
||||
if (diff < 0) {
|
||||
return <FormattedMessage id='relative_time.just_now' defaultMessage='Just now' />
|
||||
} else if (diff > (3600 * 24 * 7 * 1000)) {
|
||||
return <FormattedDate value={timestamp} />
|
||||
} else {
|
||||
return <FormattedRelative value={timestamp} initialNow={now} updateInterval={0} />
|
||||
}
|
||||
const RelativeTimestamp = ({ timestamp }) => {
|
||||
return <FormattedRelative value={new Date(timestamp)} />;
|
||||
};
|
||||
|
||||
RelativeTimestamp.propTypes = {
|
||||
timestamp: React.PropTypes.string.isRequired,
|
||||
now: React.PropTypes.any
|
||||
timestamp: React.PropTypes.string.isRequired
|
||||
};
|
||||
|
||||
export default RelativeTimestamp;
|
||||
|
Reference in New Issue
Block a user