about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2017-01-04 15:43:28 +0100
committerEugen Rochko <eugen@zeonfederated.com>2017-01-04 15:43:28 +0100
commit98b83aca372fabdfc32b05c1eb72c80a79102e53 (patch)
treee44a00d9e749d6680cd6aeacd80b60260cd1bd3a /app
parent2b0b7ff1b8b134e97c8827721a59cac21897932c (diff)
Fix #391 - relative timestamps now contain an exact datetime in title
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/components/components/relative_timestamp.jsx21
1 files changed, 12 insertions, 9 deletions
diff --git a/app/assets/javascripts/components/components/relative_timestamp.jsx b/app/assets/javascripts/components/components/relative_timestamp.jsx
index 3a5b88523..3b012b184 100644
--- a/app/assets/javascripts/components/components/relative_timestamp.jsx
+++ b/app/assets/javascripts/components/components/relative_timestamp.jsx
@@ -1,15 +1,18 @@
-import {
-  FormattedMessage,
-  FormattedDate,
-  FormattedRelative
-} from 'react-intl';
-
-const RelativeTimestamp = ({ timestamp }) => {
-  return <FormattedRelative value={new Date(timestamp)} />;
+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 RelativeTimestamp;
+export default injectIntl(RelativeTimestamp);