Skip to content

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

Fix relative date again

shamoon75de53eb837b
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 901b1048d..aef722cf9 100644
--- a/src-ui/src/app/pipes/custom-date.pipe.spec.ts
+++ b/src-ui/src/app/pipes/custom-date.pipe.spec.ts
@@ -42,9 +42,10 @@ describe('CustomDatePipe', () => {
expect(datePipe.transform(notNow, 'relative')).toEqual('Yesterday')
notNow.setDate(now.getDate())
notNow.setMonth(now.getMonth() - 1)
- expect(datePipe.transform(notNow, 'relative')).toEqual(
- now.getMonth() > 1 ? 'Last month' : 'Last year'
- )
+ if (now.getMonth() === 0) {
+ notNow.setFullYear(now.getFullYear() - 1)
+ }
+ expect(datePipe.transform(notNow, 'relative')).toEqual('Last month')
expect(datePipe.transform(now, 'relative')).toEqual('Just now')
})
})