diff --git a/src/pages/DevicePage/DeviceCommands.js b/src/pages/DevicePage/DeviceCommands.js
index 9a19de6..9f96534 100644
--- a/src/pages/DevicePage/DeviceCommands.js
+++ b/src/pages/DevicePage/DeviceCommands.js
@@ -17,7 +17,7 @@ import { cilSync } from '@coreui/icons';
import PropTypes from 'prop-types';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faClipboardCheck } from '@fortawesome/free-solid-svg-icons'
-import { prettyDate, addDays } from '../../utils/helper';
+import { prettyDate, addDays, dateToUnix } from '../../utils/helper';
import axiosInstance from '../../utils/axiosInstance';
import { getToken } from '../../utils/authHelper';
import WifiScanResultModalWidget from './WifiScanResultModal';
@@ -78,8 +78,8 @@ const DeviceCommands = ({ selectedDeviceId }) => {
Authorization: `Bearer ${getToken()}`,
},
params: {
- startDate: utcStart,
- endDate: utcEnd,
+ startDate: dateToUnix(utcStart),
+ endDate: dateToUnix(utcEnd),
},
};
diff --git a/src/pages/DevicePage/DeviceConfiguration.js b/src/pages/DevicePage/DeviceConfiguration.js
index 2981217..cbbcf3c 100644
--- a/src/pages/DevicePage/DeviceConfiguration.js
+++ b/src/pages/DevicePage/DeviceConfiguration.js
@@ -14,7 +14,7 @@ import {
} from '@coreui/react';
import CIcon from '@coreui/icons-react';
import PropTypes from 'prop-types';
-import { cleanTimestamp } from '../../utils/helper';
+import { prettyDate } from '../../utils/helper';
import axiosInstance from '../../utils/axiosInstance';
import { getToken } from '../../utils/authHelper';
@@ -82,7 +82,7 @@ const DeviceConfiguration = ({ selectedDeviceId }) => {
Last Configuration Change :
- {cleanTimestamp(device.lastConfigurationChange)}
+ {prettyDate(device.lastConfigurationChange)}
@@ -98,7 +98,7 @@ const DeviceConfiguration = ({ selectedDeviceId }) => {
Created :
- {cleanTimestamp(device.createdTimestamp)}
+ {prettyDate(device.createdTimestamp)}
@@ -106,7 +106,7 @@ const DeviceConfiguration = ({ selectedDeviceId }) => {
Last Configuration Download :
- {cleanTimestamp(device.lastConfigurationDownload)}
+ {prettyDate(device.lastConfigurationDownload)}
diff --git a/src/pages/DevicePage/DeviceHealth.js b/src/pages/DevicePage/DeviceHealth.js
index 596b687..120da4f 100644
--- a/src/pages/DevicePage/DeviceHealth.js
+++ b/src/pages/DevicePage/DeviceHealth.js
@@ -14,7 +14,7 @@ import {
import CIcon from '@coreui/icons-react';
import DatePicker from 'react-widgets/DatePicker';
import PropTypes from 'prop-types';
-import { prettyDate, addDays } from '../../utils/helper';
+import { prettyDate, addDays, dateToUnix } from '../../utils/helper';
import axiosInstance from '../../utils/axiosInstance';
import { getToken } from '../../utils/authHelper';
@@ -52,8 +52,8 @@ const DeviceHealth = ({ selectedDeviceId }) => {
Authorization: `Bearer ${getToken()}`,
},
params: {
- startDate: utcStart,
- endDate: utcEnd,
+ startDate: dateToUnix(utcStart),
+ endDate: dateToUnix(utcEnd),
},
};
diff --git a/src/pages/DevicePage/DeviceLogs.js b/src/pages/DevicePage/DeviceLogs.js
index 75a6492..39e64c5 100644
--- a/src/pages/DevicePage/DeviceLogs.js
+++ b/src/pages/DevicePage/DeviceLogs.js
@@ -13,7 +13,7 @@ import {
import CIcon from '@coreui/icons-react';
import DatePicker from 'react-widgets/DatePicker';
import PropTypes from 'prop-types';
-import { addDays, prettyDate } from '../../utils/helper';
+import { addDays, prettyDate, dateToUnix } from '../../utils/helper';
import axiosInstance from '../../utils/axiosInstance';
import { getToken } from '../../utils/authHelper';
@@ -49,8 +49,8 @@ const DeviceLogs = ({ selectedDeviceId }) => {
Authorization: `Bearer ${getToken()}`,
},
params: {
- startDate: utcStart,
- endDate: utcEnd,
+ startDate: dateToUnix(utcStart),
+ endDate: dateToUnix(utcEnd),
},
};
diff --git a/src/utils/helper.js b/src/utils/helper.js
index 28bfe8f..b6fb733 100644
--- a/src/utils/helper.js
+++ b/src/utils/helper.js
@@ -43,10 +43,16 @@ const prettyNumber = (number) => {
return `0${number}`;
};
+const unixToDateString = (unixNumber) => unixNumber * 1000;
+
+
export const prettyDate = (dateString) => {
- const date = new Date(dateString);
+ const convertedTimestamp = unixToDateString(dateString);
+ const date = new Date(convertedTimestamp);
return `${date.getFullYear()}-${prettyNumber(date.getMonth() + 1)}-${prettyNumber(date.getDate())}
${prettyNumber(date.getHours())}:${prettyNumber(date.getMinutes())}:${prettyNumber(
date.getSeconds(),
)}`;
};
+
+export const dateToUnix = (date) => new Date(date).getTime()/1000;
\ No newline at end of file