1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2024-12-23 01:27:14 +02:00

This reverts commit 84928e6371.

This commit is contained in:
gras 2024-04-03 21:16:59 +02:00
parent 3b55d72e0f
commit 7f68c827d8
3 changed files with 1 additions and 14 deletions

View File

@ -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:

View File

@ -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;

BIN
test/tmp/sqlite.db-journal Normal file

Binary file not shown.