From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Wed, 1 May 2024 05:06:19 +0000 (-0700) Subject: Fix relative date test that will fail across months X-Git-Tag: v2.8.0~3^2~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d516c08f094fc78427639ef9ba59a59b04834aa;p=thirdparty%2Fpaperless-ngx.git Fix relative date test that will fail across months --- 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 ddc03c773e..32505fa7ca 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') }) })