diff --git a/client/src/components/Logs/index.js b/client/src/components/Logs/index.js index 449a6538..940769ef 100644 --- a/client/src/components/Logs/index.js +++ b/client/src/components/Logs/index.js @@ -9,6 +9,7 @@ import { HashLink as Link } from 'react-router-hash-link'; import { formatTime, formatDateTime, + formatTodayDate, } from '../../helpers/helpers'; import { SERVICES, FILTERED_STATUS, TABLE_DEFAULT_PAGE_SIZE } from '../../helpers/constants'; import { getTrackerData } from '../../helpers/trackers/trackers'; @@ -115,11 +116,12 @@ class Logs extends Component { checkWhiteList = reason => reason === FILTERED_STATUS.NOT_FILTERED_WHITE_LIST; getTimeCell = ({ value }) => ( -
- - {formatTime(value)} - -
+
+ + {formatTodayDate(value) === formatTodayDate(Date.now()) + ? formatTime(value) : formatDateTime(value)} + +
); getDomainCell = (row) => { @@ -257,7 +259,7 @@ class Logs extends Component { { Header: t('time_table_header'), accessor: 'time', - maxWidth: 100, + minWidth: 105, Cell: this.getTimeCell, }, { diff --git a/client/src/helpers/helpers.js b/client/src/helpers/helpers.js index 8f9556af..53a821f0 100644 --- a/client/src/helpers/helpers.js +++ b/client/src/helpers/helpers.js @@ -39,6 +39,19 @@ export const formatDateTime = (dateTime) => { return parsedTime.toLocaleString(currentLanguage, options); }; +export const formatTodayDate = (dateTime) => { + const currentLanguage = i18n.languages[0] || 'en'; + const parsedTime = dateParse(dateTime); + const options = { + year: 'numeric', + month: 'numeric', + day: 'numeric', + hour12: false, + }; + + return parsedTime.toLocaleString(currentLanguage, options); +}; + export const normalizeLogs = logs => logs.map((log) => { const { time,