是否可以仅显示日期早于昨天的帖子

时间:2019-01-30 18:35:51

标签: javascript reactjs gatsby

如主题所述。

我希望可以通过graphql来完成。 documentation显示有一个ltgt运算符,但是当我在本地或graphiql演示中尝试该运算符时,出现错误,表示该运算符不可用...

index.js

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

的存储库

0 个答案:

没有答案