Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

Fix relative date test that will fail across months

shamoon8d516c08f094
diff --git a/src-ui/src/app/pipes/custom-date.pipe.spec.ts b/src-ui/src/app/pipes/custom-date.pipe.spec.ts
index ddc03c773..32505fa7c 100644
--- a/src-ui/src/app/pipes/custom-date.pipe.spec.ts
+++ b/src-ui/src/app/pipes/custom-date.pipe.spec.ts
@@ -33,8 +33,9 @@ describe('CustomDatePipe', () => {
const notNow = new Date(now)
notNow.setDate(now.getDate() - 1)
expect(datePipe.transform(notNow, 'relative')).toEqual('1 day ago')
- notNow.setDate(now.getDate() - 2)
- expect(datePipe.transform(notNow, 'relative')).toEqual('2 days ago')
+ notNow.setDate(now.getDate())
+ notNow.setMonth(now.getMonth() - 1)
+ expect(datePipe.transform(notNow, 'relative')).toEqual('1 month ago')
expect(datePipe.transform(now, 'relative')).toEqual('Just now')
})
})