I'm wondering what would be a nice solution to filter GraphQL queries by the current timestamp, e.g:
query {
appointments(createdAt: today) { }
}
or
query {
appointments(createdAt_gte: now) { }
}
Is it recommended to create my own resolver functions here? How would they look like, when e.g. graph.cool is used as a backend?
I don't want to rely on the correct time of the client but use the server time instead.
If you don't want to rely on the client side for the date, you can send a paramater on your query i.e.
query {
appointments(latestsOnly: true) { }
}
and resolve that paramater to the current date in the backend
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With