如主题所述。
我希望可以通过graphql来完成。 documentation显示有一个lt
和gt
运算符,但是当我在本地或graphiql演示中尝试该运算符时,出现错误,表示该运算符不可用...
export const IndexPageQuery = graphql`
query {
allEventsJson
#here I was hoping to filter all past events
#(filter: { date:{ gte: { today }}})
#but gte is not accepted and I'm unsure how to set today's date in
#the query (iso8601 date through a JS variable was not accepted)
{
edges {
node {
id
title
date(formatString: "DD-MM-YYYY")
month: date(formatString: "MMM")
day: date(formatString: "DD")
year: date(formatString: "YYYY")
}
}
}
}
`
我有一个带有demo here
的存储库