In my app, I need the ability to fire off a request every few minutes to the WP backend to get any posts that have beed added or edited since the last time I checked. Currently though, WPGraphQL only supports doing date queries using day, month and year. You can't get more specific than that and narrow it down to a certain hour/minute/second. Example:
query getPosts {
posts(
first: 10,
where: {
dateQuery: {
column: MODIFIED
after: {
# Need to add hour, minute & second here.
day: 13
month: 4
year: 2020
}
}
}
) {
nodes {
postId
modifiedGmt
}
}
}
WP_Query() does provide that ability by accepting a strtotime() compatible string as the before/after argument. Documentation: https://developer.wordpress.org/reference/classes/wp_query/#date-parameters
Even if we want to avoid accepting an arbitrary string like WP_Query() does, I think this can still be accomplished by accepting hour, minute, and second input args for before and after. Then apps like mine that need to query for published/modified posts on a frequent interval would be able to do so.
Who's with me?
In my app, I need the ability to fire off a request every few minutes to the WP backend to get any posts that have beed added or edited since the last time I checked. Currently though, WPGraphQL only supports doing date queries using day, month and year. You can't get more specific than that and narrow it down to a certain hour/minute/second. Example:
WP_Query()does provide that ability by accepting astrtotime()compatible string as thebefore/afterargument. Documentation: https://developer.wordpress.org/reference/classes/wp_query/#date-parametersEven if we want to avoid accepting an arbitrary string like
WP_Query()does, I think this can still be accomplished by acceptinghour,minute, andsecondinput args forbeforeandafter. Then apps like mine that need to query for published/modified posts on a frequent interval would be able to do so.Who's with me?