summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSukanya Pandey <sukapan1@in.ibm.com>2020-08-04 21:13:07 +0300
committerYoshie Muranaka <yoshiemuranaka@gmail.com>2020-08-14 00:18:48 +0300
commit944840f040d3c7aac1e4fb911beb940c977b74df (patch)
tree03aaa7f78255ca3ff201246b1fade1d63e5d2174 /src
parent92a0a4ac1f25271c1861d7c97a0d8344dd578905 (diff)
downloadwebui-vue-944840f040d3c7aac1e4fb911beb940c977b74df.tar.xz
Remove date bug in event logs page
- Before this commit the filtering on date for offset timing wasnt working. -After this commit the filtering on date for UTC as well for offset is working as expected. Signed-off-by: Sukanya Pandey <sukapan1@in.ibm.com> Change-Id: Ib627ce944c269dfe52b2ac4fd5670786ec05bb1f
Diffstat (limited to 'src')
-rw-r--r--src/components/Mixins/TableFilterMixin.js20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/components/Mixins/TableFilterMixin.js b/src/components/Mixins/TableFilterMixin.js
index 7cb7007d..1a5425f9 100644
--- a/src/components/Mixins/TableFilterMixin.js
+++ b/src/components/Mixins/TableFilterMixin.js
@@ -30,14 +30,24 @@ const TableFilterMixin = {
propertyKey = 'date'
) {
if (!startDate && !endDate) return tableData;
- const startDateInMs = startDate ? startDate.getTime() : 0;
- const endDateInMs = endDate
- ? endDate.getTime()
- : Number.POSITIVE_INFINITY;
+ let startDateInMs = startDate ? startDate.getTime() : 0;
+ let endDateInMs = endDate ? endDate.getTime() : Number.POSITIVE_INFINITY;
+
+ const isUtcDisplay = this.$store.getters['global/isUtcDisplay'];
+
+ //Offset preference selected
+ if (!isUtcDisplay) {
+ startDateInMs = startDate
+ ? startDate.getTime() + startDate.getTimezoneOffset() * 60000
+ : 0;
+ endDateInMs = endDate
+ ? endDate.getTime() + endDate.getTimezoneOffset() * 60000
+ : Number.POSITIVE_INFINITY;
+ }
+
return tableData.filter(row => {
const date = row[propertyKey];
if (!(date instanceof Date)) return;
-
const dateInMs = date.getTime();
if (dateInMs >= startDateInMs && dateInMs <= endDateInMs) return row;
});