]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Fix relative date again
authorshamoon <4887959+shamoon@users.noreply.github.com>
Thu, 2 Jan 2025 05:38:32 +0000 (21:38 -0800)
committershamoon <4887959+shamoon@users.noreply.github.com>
Thu, 2 Jan 2025 05:49:51 +0000 (21:49 -0800)
src-ui/src/app/pipes/custom-date.pipe.spec.ts

index 901b1048dbcde00458ad5c50eef7cfd412c4f9e1..aef722cf943b2d5c2dae2f7636202f2de353987c 100644 (file)
@@ -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')
   })
 })