From ba77aefe02159325752cfa79210f5e4b5fcef77e Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Wed, 15 Jun 2016 08:13:17 -0400 Subject: 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 --- webapp/utils/utils.jsx | 52 -------------------------------------------------- 1 file changed, 52 deletions(-) (limited to 'webapp/utils/utils.jsx') 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 ( - - ); -} - -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(); -- cgit v1.2.3-1-g7c22