From 7f68c827d89490165ec47a5789e349f5c8a6b509 Mon Sep 17 00:00:00 2001 From: gras Date: Wed, 3 Apr 2024 21:16:59 +0200 Subject: [PATCH] This reverts commit 84928e6371988c302d5fd13504d324df00195c1d. --- src/backend/model/database/SearchManager.ts | 2 +- src/common/Utils.ts | 13 ------------- test/tmp/sqlite.db-journal | Bin 0 -> 8720 bytes 3 files changed, 1 insertion(+), 14 deletions(-) create mode 100644 test/tmp/sqlite.db-journal diff --git a/src/backend/model/database/SearchManager.ts b/src/backend/model/database/SearchManager.ts index 9977ca65..75010fdb 100644 --- a/src/backend/model/database/SearchManager.ts +++ b/src/backend/model/database/SearchManager.ts @@ -779,7 +779,7 @@ export class SearchManager { break; case DatePatternFrequency.months_ago: - to.setTime(Utils.addMonthToDate(to, -1 * tq.agoNumber).getTime()); + to.setUTCMonth(to.getUTCMonth() - tq.agoNumber); break; case DatePatternFrequency.years_ago: diff --git a/src/common/Utils.ts b/src/common/Utils.ts index a47898ce..a9a7a862 100644 --- a/src/common/Utils.ts +++ b/src/common/Utils.ts @@ -220,19 +220,6 @@ export class Utils { return dayOfYear; } - //Adding months to a date differently from standard JS - //this function makes sure that if date is the 31st and you add a month, you will get the last day of the next month - //so adding or subtracting a month from 31st of march will give 30th of april or 28th of february respectively (29th on leap years). - static addMonthToDate(date: Date, numMonths: number) { - let result = new Date(date) - const expectedMonth = ((date.getMonth() + numMonths) % 12 + 12) % 12; //inner %12 + 12 makes correct handling of negative months - result.setMonth(result.getMonth() + numMonths); - if (result.getMonth() !== expectedMonth) { - result.setDate(0); - } - return result; - } - static renderDataSize(size: number): string { const postFixes = ['B', 'KB', 'MB', 'GB', 'TB']; let index = 0; diff --git a/test/tmp/sqlite.db-journal b/test/tmp/sqlite.db-journal new file mode 100644 index 0000000000000000000000000000000000000000..41fef9eebaebbae9c91a7f46412db09bd82d3d74 GIT binary patch literal 8720 zcmeHLOK;mo5Edg#vST}To@!9ECFB~l;5c1Am%OxfZ3PhG$gwR0$tA*)y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