Closed MrMooky closed 4 months ago
Edit the date
field in your blueprint and make sure you enable time. Otherwise, only date will get saved. You can see that the times in all the carbon instances show them as midnight.
Yes, that will work. The reason I created an issue for that was because editors have to set a time now. Maybe for a future update you guys could consider how Laravel does it. When an entry is published, the date will get the current date with the current time. Sort of like the created_at
column for Laravel models. And then editors can optionally change that, which will likely not happen.
Anyway, just a thought.
Bug description
I'm trying to get the latest posts from a collection like this:
{{ collection:posts sort="date:desc" limit="{limit}" as="posts" }}
.I was wondering why the outcome was not the expected one and saw that the
date
did not store the hour, minute, second (see screenshot). It's kind of obvious, but when usingdate|desc
for sorting, I'd expect the sorting to be accurate. I may be missing another way to accomplish this and this could not be considered a bug.If you create 2 entries 5 minutes apart and I use the above mentioned collection query, I expect that the latest article shows up first. But due to the date, the sorting is not right.
How to reproduce
Create a couple of entries in a collection and use the following query to retrieve them:
{{ collection:posts sort="date:desc" limit="{limit}" as="posts" }}
The latest article will likely not be the first in the list.
Logs
No response
Environment
Installation
Fresh statamic/statamic site via CLI
Additional details
No response