Merge pull request #2074 from rgarmsen2295/plt-1882

PLT-1882 Fixed issue with on-hover timestamps
Этот коммит содержится в:
Joram Wilander
2016-02-05 12:46:02 -05:00
родитель 4fabe574fa d416a04e52
Коммит 29b5821c40
2 изменённых файлов: 17 добавлений и 1 удалений

Просмотреть файл

@@ -2,6 +2,7 @@
// See License.txt for license information.
import Constants from '../utils/constants.jsx';
import * as Utils from '../utils/utils.jsx';
import {FormattedRelative, FormattedDate} from 'mm-intl';
@@ -24,7 +25,7 @@ export default class TimeSince extends React.Component {
if (this.props.sameUser) {
return (
<time className='post__time'>
<FormattedRelative value={this.props.eventTime} />
{Utils.displayTimeFormatted(this.props.eventTime)}
</time>
);
}

Просмотреть файл

@@ -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);