summaryrefslogtreecommitdiffstats
path: root/webapp/utils/utils.jsx
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2016-06-15 08:13:17 -0400
committerJoram Wilander <jwawilander@gmail.com>2016-06-15 08:13:17 -0400
commitba77aefe02159325752cfa79210f5e4b5fcef77e (patch)
tree48d41a615a07e6867a36baaa78d227a87e422348 /webapp/utils/utils.jsx
parent3f4d38f58ae086c6570bea7082f25cbdbc52c85d (diff)
downloadchat-ba77aefe02159325752cfa79210f5e4b5fcef77e.tar.gz
chat-ba77aefe02159325752cfa79210f5e4b5fcef77e.tar.bz2
chat-ba77aefe02159325752cfa79210f5e4b5fcef77e.zip
PLT-3202 Re-render timestamps when display settings switch between 12h and 24h (#3337)
* Made post timestamp switch from 12h to 24h without refreshing * Made RHS post timestamps switch from 12h to 24h without refreshing
Diffstat (limited to 'webapp/utils/utils.jsx')
-rw-r--r--webapp/utils/utils.jsx52
1 files changed, 0 insertions, 52 deletions
diff --git a/webapp/utils/utils.jsx b/webapp/utils/utils.jsx
index 452ee1f7d..96eedaf75 100644
--- a/webapp/utils/utils.jsx
+++ b/webapp/utils/utils.jsx
@@ -13,9 +13,7 @@ var ActionTypes = Constants.ActionTypes;
import * as AsyncClient from './async_client.jsx';
import Client from './web_client.jsx';
-import React from 'react';
import {browserHistory} from 'react-router';
-import {FormattedTime} from 'react-intl';
import icon50 from 'images/icon50x50.png';
import bing from 'images/bing.mp3';
@@ -225,56 +223,6 @@ 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='2-digit'
- minute='2-digit'
- hour12={!useMilitaryTime}
- />
- );
-}
-
-export function isMilitaryTime() {
- return PreferenceStore.getBool(Constants.Preferences.CATEGORY_DISPLAY_SETTINGS, 'use_military_time');
-}
-
-export function displayDateTime(ticks) {
- var seconds = Math.floor((Date.now() - ticks) / 1000);
-
- var interval = Math.floor(seconds / 3600);
-
- if (interval > 24) {
- return this.displayTime(ticks);
- }
-
- if (interval > 1) {
- return interval + ' hours ago';
- }
-
- if (interval === 1) {
- return interval + ' hour ago';
- }
-
- interval = Math.floor(seconds / 60);
- if (interval >= 2) {
- return interval + ' minutes ago';
- }
-
- if (interval >= 1) {
- return '1 minute ago';
- }
-
- return 'just now';
-}
-
-export function displayCommentDateTime(ticks) {
- return displayDate(ticks) + ' ' + displayTime(ticks);
-}
-
// returns Unix timestamp in milliseconds
export function getTimestamp() {
return Date.now();