mirror of
https://github.com/bpatrik/pigallery2.git
synced 2024-12-23 01:27:14 +02:00
Adapted test data to use the new month subtract method
This commit is contained in:
parent
1e50f1b2e5
commit
893df7db74
@ -132,18 +132,9 @@ describe('SearchManager', (sqlHelper: DBTestHelper) => {
|
|||||||
delete pFaceLessTmp.metadata.faces;
|
delete pFaceLessTmp.metadata.faces;
|
||||||
d = new Date();
|
d = new Date();
|
||||||
//we create a date 1 month and 1 day before now
|
//we create a date 1 month and 1 day before now
|
||||||
if ([1, 3, 5, 7, 8, 10, 0].includes(d.getMonth())) {
|
d = Utils.addMonthToDate(d, -1); //subtract 1 month in the "human way"
|
||||||
//Now is a month after a long month: feb (1), april (3), june (5), august(7), september(8), november (10), january (0)
|
d.setDate(d.getDate()-1); //subtract 1 day
|
||||||
pFaceLessTmp.metadata.creationDate = d.getTime() - 60 * 60 * 24 * 32 * 1000;
|
pFaceLessTmp.metadata.creationDate = d.getTime();
|
||||||
} else if (d.getMonth() == 2 && Utils.isDateFromLeapYear(d)) {
|
|
||||||
//march on leap years
|
|
||||||
pFaceLessTmp.metadata.creationDate = d.getTime() - 60 * 60 * 24 * 30 * 1000;
|
|
||||||
} else if (d.getMonth() == 2) {
|
|
||||||
//march (and not leap years)
|
|
||||||
pFaceLessTmp.metadata.creationDate = d.getTime() - 60 * 60 * 24 * 29 * 1000;
|
|
||||||
} else { //all other months must come after a short month with 30 days, so we subtract 31
|
|
||||||
pFaceLessTmp.metadata.creationDate = d.getTime() - 60 * 60 * 24 * 31 * 1000;
|
|
||||||
}
|
|
||||||
pFaceLessTmp.metadata.creationDateOffset = "+02:00";
|
pFaceLessTmp.metadata.creationDateOffset = "+02:00";
|
||||||
|
|
||||||
dir = await DBTestHelper.persistTestDir(directory);
|
dir = await DBTestHelper.persistTestDir(directory);
|
||||||
|
Loading…
Reference in New Issue
Block a user