0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-03-11 02:23:09 -05:00

fix(server): do not return year with weird timezone info i.e before 1850

This commit is contained in:
Alex Tran 2025-01-26 21:41:36 -06:00
parent f6cbc9db06
commit 6a3267911b

View file

@ -137,6 +137,7 @@ export class AssetRepository implements IAssetRepository {
),
)
.select((eb) => eb.fn.jsonAgg(eb.table('res')).as('assets'))
.where('localDateTime', '>=', new Date('1850-01-01'))
.groupBy(sql`("localDateTime" at time zone 'UTC')::date`)
.orderBy(sql`("localDateTime" at time zone 'UTC')::date`, 'desc')
.limit(10)
@ -585,6 +586,7 @@ export class AssetRepository implements IAssetRepository {
.$if(!!options.isTrashed, (qb) => qb.where('assets.status', '!=', AssetStatus.DELETED))
.where('assets.deletedAt', options.isTrashed ? 'is not' : 'is', null)
.where('assets.isVisible', '=', true)
.where('assets.localDateTime', '>=', new Date('1850-01-01'))
.$if(!!options.albumId, (qb) =>
qb
.innerJoin('albums_assets_assets', 'assets.id', 'albums_assets_assets.assetsId')