Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion server/src/queries/asset.repository.sql
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,14 @@ select
json_agg("res") as "assets"
from
"res"
where
"localDateTime" >= $8
group by
("localDateTime" at time zone 'UTC')::date
order by
("localDateTime" at time zone 'UTC')::date desc
limit
$8
$9

-- AssetRepository.getByIds
select
Expand Down Expand Up @@ -258,6 +260,7 @@ with
where
"assets"."deletedAt" is null
and "assets"."isVisible" = $2
and "assets"."localDateTime" >= $3
)
select
"timeBucket",
Expand Down
2 changes: 2 additions & 0 deletions server/src/repositories/asset.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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')
Expand Down
Loading