chore(@desktop/wallet): Use correct period of weeks filtering (#11362)

This commit is contained in:
Cuteivist 2023-07-03 11:51:34 +02:00 committed by GitHub
parent ad489a224c
commit c842876791
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 8 deletions

View File

@ -1,6 +1,7 @@
import QtQuick 2.13 import QtQuick 2.13
import SortFilterProxyModel 0.2 import SortFilterProxyModel 0.2
import StatusQ.Core 0.1
import utils 1.0 import utils 1.0
@ -46,19 +47,19 @@ QtObject {
toTimestamp = dt1.valueOf() toTimestamp = dt1.valueOf()
break break
case Constants.TransactionTimePeriod.ThisWeek: case Constants.TransactionTimePeriod.ThisWeek:
let dt2 = new Date() let dt2 = LocaleUtils.getFirstDayOfTheCurrentWeek()
let firstDayOfCurrentWeek = dt2.getDate() - dt2.getDay()
dt2.setDate(firstDayOfCurrentWeek)
dt2.setHours(0, 0, 0, 0) dt2.setHours(0, 0, 0, 0)
fromTimestamp = dt2.valueOf() // This week fromTimestamp = dt2.valueOf() // First day of this week
toTimestamp = new Date().valueOf() toTimestamp = new Date().valueOf() // Today
break break
case Constants.TransactionTimePeriod.LastWeek: case Constants.TransactionTimePeriod.LastWeek:
let dt3 = new Date() let dt3 = LocaleUtils.getFirstDayOfTheCurrentWeek()
dt3.setDate(dt3.getDate() - 7) dt3.setDate(dt3.getDate() - 7)
dt3.setHours(0, 0, 0, 0) dt3.setHours(0, 0, 0, 0)
fromTimestamp = dt3.valueOf() // Last week fromTimestamp = dt3.valueOf() // First day of last week
toTimestamp = new Date().valueOf() dt3.setDate(dt3.getDate() + 6)
dt3.setHours(23, 59, 59, 0)
toTimestamp = dt3.valueOf() // Last day of last week
break break
case Constants.TransactionTimePeriod.ThisMonth: case Constants.TransactionTimePeriod.ThisMonth:
let dt4 = new Date() let dt4 = new Date()