Hey! This is my first time posting here.
I am following the example below:
client.query([
Prismic.Predicates.month('my.blog_post.release_date', 'May'),
Prismic.Predicates.year('my.blog_post.release_date', 2016)
]).then(res => {
// res is the response object, res.results holds the documents
})
In order to implement an archive for my client's blog. I am finding success when I am using the Prismic.Predicates.month OR Prismic.Predicates.year.... but not when they are being used together to return a result. I am receiving the following error:
My code is as follows. Note that the variable 'year' is stored in my state from another listener, so it is not returning 'null', it is returning whatever date I select on my dropdown.
const queryByDate = (e) => {
let month = e.target.value;
const fetchDates = async (month, year) => {
const response = await Client.query(
Prismic.Predicates.month('my.blog.post_date', month),
Prismic.Predicates.year('my.blog.post_date', year)
);
if (response) {
setDocData(response.results);
console.log("response", response.results);
}
}
fetchDates(month, year);
}
Any help would be appreciated! Like I said the month OR year will work in returning posts, but not both together, any ideas?
Thanks!