Skip to content

High performance self-hosted photo and video management solution.

fix: local offset hours (#21147)

Jason Rasmussen03e792258965
diff --git a/server/src/queries/asset.repository.sql b/server/src/queries/asset.repository.sql
index 712fb08a50..e2bc80eabe 100644
--- a/server/src/queries/asset.repository.sql
+++ b/server/src/queries/asset.repository.sql
@@ -277,7 +277,7 @@ with
epoch
from
(
- asset."localDateTime" - asset."fileCreatedAt" at time zone 'UTC'
+ asset."localDateTime" AT TIME ZONE 'UTC' - asset."fileCreatedAt" at time zone 'UTC'
)
)::real / 3600 as "localOffsetHours",
"asset"."ownerId",
diff --git a/server/src/repositories/asset.repository.ts b/server/src/repositories/asset.repository.ts
index 61ccbf6541..6752d7bf62 100644
--- a/server/src/repositories/asset.repository.ts
+++ b/server/src/repositories/asset.repository.ts
@@ -566,7 +566,7 @@ export class AssetRepository {
sql`asset.type = 'IMAGE'`.as('isImage'),
sql`asset."deletedAt" is not null`.as('isTrashed'),
'asset.livePhotoVideoId',
- sql`extract(epoch from (asset."localDateTime" - asset."fileCreatedAt" at time zone 'UTC'))::real / 3600`.as(
+ sql`extract(epoch from (asset."localDateTime" AT TIME ZONE 'UTC' - asset."fileCreatedAt" at time zone 'UTC'))::real / 3600`.as(
'localOffsetHours',
),
'asset.ownerId',