Interesting. I’d start by looking at your date format settings, although it looks like whichever format is being used (sensible or US ridiculous :P), they are out of order.
Could you please post here those settings, as well as how you are outputting your collection?
Also, is publish_date explicitly set on all of these pages? I ask because some of the fallbacks for dates are not intuitive in my opinion.
And here the date configuration from user/config/system.yaml:
dateformat:
default: # The default date format Grav expects in the `date: ` field
short: 'jS M Y' # Short date format
long: 'F jS \a\t g:ia' # Long date format
publish_dates: true
I had a quick look into the Grav core code and found a resolved issue that gave me some clues. I still don’t fully understand how it is sorting this because even as a string, it’s not in order.
Try these:
In your collection definition, change order.by to just “publish_date”. It’s not a documented option but does appear to be supported, and it sorts differently in the code.
Try the sort_flags option documented there, as it appears to be involved in the issue mentioned. No guidance given and not sure what value you would use in Twig, but try the ones linked like ‘SORT_REGULAR’ (as a string I guess??) etc. So:
Do you know much about debugging in Grav? By selectively dumping values into the debug console, you might be able to see where the problem is introduced.
Otherwise, you might get more satisfaction from someone on Discord. If you do, mention that you posted here and link to this, and also report back here what you find out. It should be valid to ask a question in a Github issue too (this might even be a bug), but it’s really a question of luck whether they get looked at or answered.
Hello @hughbris, thanks for effort to find a solution. I’ve tried using the sort_flags parameter without success. I think sorting a collection should not be that complex. Due to time constraints I will use the chronological sorting with date now.