Hi, prismic team, why I can't sort data with the timstampts type and date type in graphql? ..
Thanks for contributing to the Prismic community.
In fact it seems that the query that you are doing is not correct, but that depends on what technology you are using pure GraphQL (Prismic implementation), Gatsby, etc...
I think you query should look like this if you are using pure GraphQL
query {
allPages(sortBy:meta_firstPublicationDate_ASC) {
edges {
node {
_meta {
firstPublicationDate
}
}
}
}
}
Please let me know if that answers you question,
Fares
Thanks for reply @Fares ..
I use pure graphql from prismic, I create a publishDate field so that users can publish old posts with the date they want...
so why does sort for date field not work in prismic pure graphql?
Thanks, @muhammad.ilhamsa1 for the clarification, ok then it is a custom field.
I will try to reproduce and get back you
Thank you. I'll be waiting for that .
Hi Muhammad,
It is working for me here is screenshot
In fact I think that the you can't use camelcase uid for a field, it should be all lowercase
Your query should look like:
query {
allPages(sortBy:publishdate_ASC) {
edges {
node {
publishdate
}
}
}
}
wow it worked. thank you Fares. you saved me
do I need to change my entire uid for a field from camelCase to snake_case. to avoid bugs in the future?
You are welcome; in fact, I've checked our team, and it seems that there is no issue in using snake_case for your UID.
I've done few tests, and there doesn't seem to be an issue in GraphQL
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.