diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/components/Mixins/TableFilterMixin.js | 20 |
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; }); |