Open j-palindrome opened 7 months ago
Hi @j-palindrome -- thank you for reporting. I was able to see some of the same behavior that you're mentioning, and I agree that it's a bit unexpected and probably not the best user experience.
In my case, the issue was caused by two things --
null
or undefined datetime
value get sorted first{
"_id": "my-exhibition-document",
"_type": "exhibition",
"startDate": "2024-05-16T15:25:39.429Z"
}
but I had a working draft document where I updated that date, like:
{
"_id": "drafts.my-exhibition-document",
"_type": "exhibition",
"startDate": "2024-02-16T15:25:39.429Z"
}
The document would show up higher than it should have, based on what I was looking at.
In your case, do you have discrepancies between published and draft documents, or have undefined datetime fields?
Again, this is behavior that should be rectified and I am putting in a ticket for it, but I just wanted to confirm with you that we have accurately captured what's going on, and what we need to work on.
Thanks again for reporting, and for your help!
If you find a security vulnerability, do NOT open an issue. Email security@sanity.io instead.
Describe the bug
Sort order for date fields sorts in a seemingly random order.
To Reproduce
document
schema:Expected behavior
Descending sort order for dates in
YYYY-MM-DD
format.Screenshots
This collection is sorted like:
2022-11-01
2023-04-01
2021-11-01
2022-03-01
Which versions of Sanity are you using?
What operating system are you using?
MacOS Sonoma 14.2.1
Which versions of Node.js / npm are you running?
Run
npm -v && node -v
in the terminal and copy-paste the result here.