Skip to content

[6.x] Fix collection:next and collection:previous tags with dated collection entries - #15864

Merged
jasonvarga merged 1 commit into
6.xfrom
fix-collection-navigation
Nov 12, 2026
Merged

jasonvarga merged 1 commit into
6.xfrom
fix-collection-navigation

Conversation

@duncanmcclean

@duncanmcclean duncanmcclean commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

This pull request fixes an issue where the collection:next and collection:previous tags could loop between entries or skip entries in a dated collection.

This was happening because shorthand date queries cast the date to a string while parsing the operator, and equality comparisons also used the formatted date string. When the site's date format omits the time, entries submitted at different times on the same day are treated as having the same timestamp. For entries that genuinely share a timestamp, the title comparisons were also case-sensitive, unlike the sorting.

This PR fixes it by preserving date objects in shorthand queries, comparing their actual instants, and using the same comparator for navigation ties as sorting uses.

Spotted while working on statamic.com.

@duncanmcclean duncanmcclean changed the title [6.x] Fix navigation between dated collection entries [6.x] Fix collection:next and collection:previous tags with dated collection entries Nov 12, 2026
@jasonvarga
jasonvarga merged commit 0a71068 into 6.x Nov 12, 2026
68 checks passed
@jasonvarga
jasonvarga deleted the fix-collection-navigation branch November 12, 2026 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants