fix(server): handle 5 digit years (#6457)

This commit is contained in:
Jason Rasmussen
2024-01-17 16:08:38 -05:00
committed by GitHub
parent 574aecc1e2
commit 6f291006e4
3 changed files with 13 additions and 13 deletions
@@ -687,7 +687,7 @@ export class AssetRepository implements IAssetRepository {
const truncated = dateTrunc(options);
return (
this.getBuilder(options)
.andWhere(`${truncated} = :timeBucket`, { timeBucket })
.andWhere(`${truncated} = :timeBucket`, { timeBucket: timeBucket.replace(/^[+-]/, '') })
// First sort by the day in localtime (put it in the right bucket)
.orderBy(truncated, 'DESC')
// and then sort by the actual time
@@ -757,10 +757,7 @@ export class AssetRepository implements IAssetRepository {
private getBuilder(options: AssetBuilderOptions) {
const { isArchived, isFavorite, isTrashed, albumId, personId, userIds, withStacked, exifInfo, assetType } = options;
let builder = this.repository
.createQueryBuilder('asset')
.where('asset.isVisible = true')
.andWhere('asset.fileCreatedAt < NOW()');
let builder = this.repository.createQueryBuilder('asset').where('asset.isVisible = true');
if (assetType !== undefined) {
builder = builder.andWhere('asset.type = :assetType', { assetType });
}