Merge pull request #272 from trecoool/fix/group-by-date-album-order
This commit is contained in:
@@ -28,13 +28,17 @@ export async function gallery (res: Response, share: SharedLink, openItem?: numb
|
||||
// You can specify this in your docker-compose file via the PUBLIC_BASE_URL env var.
|
||||
const publicBaseUrl = process.env.PUBLIC_BASE_URL || (res.req.protocol + '://' + res.req.headers.host)
|
||||
|
||||
// Date grouping needs chronological order; sort newest-first when enabled
|
||||
// (overrides any album.order the upstream applied). Sort by the same local
|
||||
// timestamp the grouping buckets on, so buckets stay contiguous / ordered.
|
||||
// Date grouping needs chronological order; follow the album's own sort
|
||||
// direction, defaulting to newest-first when it has none (individual shares).
|
||||
// Sort by the same local timestamp the grouping buckets on, so buckets stay
|
||||
// contiguous / ordered.
|
||||
const groupByDate = groupByDateMode()
|
||||
if (groupByDate) {
|
||||
const ascending = share.album?.order === 'asc'
|
||||
const sortKey = (a: typeof share.assets[number]) => a.localDateTime || a.fileCreatedAt || ''
|
||||
share.assets.sort((a, b) => sortKey(b).localeCompare(sortKey(a)))
|
||||
share.assets.sort((a, b) => ascending
|
||||
? sortKey(a).localeCompare(sortKey(b))
|
||||
: sortKey(b).localeCompare(sortKey(a)))
|
||||
}
|
||||
|
||||
// Metadata display flags. Read once here and forwarded to the client via
|
||||
|
||||
@@ -75,7 +75,7 @@ Group the gallery's thumbnails by date, with a header above each group.
|
||||
- `"month"` - month headers like "December 2024".
|
||||
- `"day"` - day headers like "Wed, 25 Dec 2024" (matching Immich's own timeline format).
|
||||
|
||||
Grouping uses each photo's local "taken" date (matching Immich's own timeline), and sorts photos newest-first. Items missing a creation date end up under an "Undated" bucket at the end (or render without any header when the whole gallery is undated).
|
||||
Grouping uses each photo's local "taken" date (matching Immich's own timeline). Photos follow the album's own sort order from Immich - "Oldest first" puts the earliest group at the top, "Newest first" the most recent - and default to newest-first for shares with no album order. Items missing a creation date end up under an "Undated" bucket at the end (or render without any header when the whole gallery is undated).
|
||||
|
||||
> [!IMPORTANT]
|
||||
> Requires **"Show metadata"** to be enabled on the share in Immich. When that's off, Immich strips creation dates from the assets it returns to IPP, so grouping won't work.
|
||||
|
||||
Reference in New Issue
Block a user