So i have this query in graphql. But greater than(gt) and less than(lt) is not a defined field.
query Test {
allStrapiEvent(filter:{date:{gt:"02/13/2019"}}){
edges{
node{
name
date(formatString:"MM/DD/YYYY")
}
}
}
}
It looks like
date
is ofString
type, and therefore doesn't get the comparison operators (gt, lt, gte, lte); which is a shame, because this is really useful.I think as a workaround, you can add an additional field like
timestamp
and store the date in number (if not already provided by your CMS). Then you can use comparison operators on them.Then say you want to get events starting from yesterday. You can get the unix timestamp like
moment().subtract(1, 'day').format('X')
// 1549044285Not ideal, but will work.