fix to display correct delivered time on console event trigger (close #1309) (#1312)

This commit is contained in:
Aravind Shankar 2019-01-08 13:38:03 +05:30 committed by Shahidh K Muhammed
parent 3f79ad2809
commit 35d0e8f3f3
5 changed files with 28 additions and 10 deletions

View File

@ -16,7 +16,7 @@ import {
setLimit,
addOrder,
} from './FilterActions';
import { ordinalColSort } from '../utils';
import { ordinalColSort, convertDateTimeToLocale } from '../utils';
import '../TableCommon/ReactTableFix.css';
const ViewRows = ({
@ -112,7 +112,7 @@ const ViewRows = ({
}
let content = row[col] === undefined ? 'NULL' : row[col].toString();
if (col === 'created_at') {
content = new Date(row[col]).toUTCString();
content = convertDateTimeToLocale(row[col]);
}
if (col === 'event_id') {
content = row.id.toString();
@ -282,7 +282,7 @@ const ViewRows = ({
return status;
}
if (col === 'created_at') {
const formattedDate = new Date(r.created_at).toUTCString();
const formattedDate = convertDateTimeToLocale(r.created_at);
return formattedDate;
}
const content =

View File

@ -17,7 +17,7 @@ import {
setLimit,
addOrder,
} from './FilterActions';
import { ordinalColSort } from '../utils';
import { ordinalColSort, convertDateTimeToLocale } from '../utils';
import '../TableCommon/ReactTableFix.css';
import * as tooltip from '../Common/Tooltips';
import OverlayTrigger from 'react-bootstrap/lib/OverlayTrigger';
@ -115,7 +115,7 @@ const ViewRows = ({
}
let content = row[col] === undefined ? 'NULL' : row[col].toString();
if (col === 'created_at') {
content = new Date(row[col]).toUTCString();
content = convertDateTimeToLocale(row[col]);
}
if (col === 'event_id') {
content = row.id.toString();
@ -304,7 +304,7 @@ const ViewRows = ({
return status;
}
if (col === 'created_at') {
const formattedDate = new Date(r.created_at).toUTCString();
const formattedDate = convertDateTimeToLocale(r.created_at);
return formattedDate;
}
const content =

View File

@ -16,7 +16,7 @@ import {
setLimit,
addOrder,
} from './FilterActions';
import { ordinalColSort } from '../utils';
import { ordinalColSort, convertDateTimeToLocale } from '../utils';
import Spinner from '../../../Common/Spinner/Spinner';
import '../TableCommon/ReactTableFix.css';
@ -114,7 +114,7 @@ const ViewRows = ({
}
let content = row[col] === undefined ? 'NULL' : row[col].toString();
if (col === 'created_at') {
content = new Date(row[col]).toUTCString();
content = convertDateTimeToLocale(row[col]);
}
return <div className={conditionalClassname}>{content}</div>;
};
@ -288,7 +288,7 @@ const ViewRows = ({
return status;
}
if (col === 'created_at') {
const formattedDate = new Date(r.created_at).toUTCString();
const formattedDate = convertDateTimeToLocale(row[col]);
return formattedDate;
}
const content =

View File

@ -27,6 +27,7 @@ import {
} from './LogActions';
import * as tooltip from '../Common/Tooltips';
import OverlayTrigger from 'react-bootstrap/lib/OverlayTrigger';
import { convertDateTimeToLocale } from '../utils';
class StreamingLogs extends Component {
constructor(props) {
@ -221,7 +222,7 @@ class StreamingLogs extends Component {
return <div className={conditionalClassname}>{r.id}</div>;
}
if (col === 'created_at') {
const formattedDate = new Date(r.created_at).toUTCString();
const formattedDate = convertDateTimeToLocale(r.created_at);
return <div className={conditionalClassname}>{formattedDate}</div>;
}
if (col === 'operation') {

View File

@ -132,6 +132,22 @@ const getTableColumns = tableSchema => {
return [];
};
const convertDateTimeToLocale = dateTime => {
const options = {
hourCycle: 'h24',
day: 'numeric',
hour: '2-digit',
minute: '2-digit',
month: 'short',
second: '2-digit',
timeZoneName: 'short',
weekday: 'short',
year: 'numeric',
};
return new Date(dateTime + 'Z').toLocaleString('en-US', options);
};
export {
ordinalColSort,
findTableFromRel,
@ -140,4 +156,5 @@ export {
getIngForm,
escapeRegExp,
getTableColumns,
convertDateTimeToLocale,
};