summaryrefslogtreecommitdiffstats
path: root/web/react/utils/utils.jsx
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2016-02-05 12:46:02 -0500
committerJoram Wilander <jwawilander@gmail.com>2016-02-05 12:46:02 -0500
commit29b5821c4098325ccec172ee0bc386c8b3b8f815 (patch)
tree507d1147a180084c8c2cd04e9fb0861fbbe29383 /web/react/utils/utils.jsx
parent4fabe574fadb3e35a5f87c31a421daf1cff57af8 (diff)
parentd416a04e52783460328f5e26295071d75d8897cd (diff)
downloadchat-29b5821c4098325ccec172ee0bc386c8b3b8f815.tar.gz
chat-29b5821c4098325ccec172ee0bc386c8b3b8f815.tar.bz2
chat-29b5821c4098325ccec172ee0bc386c8b3b8f815.zip
Merge pull request #2074 from rgarmsen2295/plt-1882
PLT-1882 Fixed issue with on-hover timestamps
Diffstat (limited to 'web/react/utils/utils.jsx')
-rw-r--r--web/react/utils/utils.jsx15
1 files changed, 15 insertions, 0 deletions
diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx
index 6bb7baa64..4beec8d64 100644
--- a/web/react/utils/utils.jsx
+++ b/web/react/utils/utils.jsx
@@ -14,6 +14,8 @@ import * as AsyncClient from './async_client.jsx';
import * as client from './client.jsx';
import Autolinker from 'autolinker';
+import {FormattedTime} from 'mm-intl';
+
export function isEmail(email) {
// writing a regex to match all valid email addresses is really, really hard (see http://stackoverflow.com/a/201378)
// so we just do a simple check and rely on a verification email to tell if it's a real address
@@ -245,6 +247,19 @@ export function displayTime(ticks, utc) {
return hours + ':' + minutes + ampm + timezone;
}
+export function displayTimeFormatted(ticks) {
+ const useMilitaryTime = PreferenceStore.getBool(Constants.Preferences.CATEGORY_DISPLAY_SETTINGS, 'use_military_time');
+
+ return (
+ <FormattedTime
+ value={ticks}
+ hour='numeric'
+ minute='numeric'
+ hour12={!useMilitaryTime}
+ />
+ );
+}
+
export function displayDateTime(ticks) {
var seconds = Math.floor((Date.now() - ticks) / 1000);