`date.after()` expected behaviour

Impacted feature

filtering by dates with the Prismic Content API.

I'm not sure of the behaviour before today, but my understand of filtering with date.after()is that the specified date would not be included, but excluded. E.g. '[date.after(my.exhibitions.end, "2026-04-19")]'would not return documents with an exhibition ending on the 19th.

Thing is, it currently does. If you're able to view our website today (the 20th), you'll see an event that ended yesterday as part of a list that we filter with

[
'[date.before(my.exhibitions.start, "2026-04-27")]',
'[date.after(my.exhibitions.end, "2026-04-19")]'
]

We've had this query for years, so I'm wondering if the behaviour of the query has changed.

What steps have you taken to resolve this issue already?

Looked into docs @prismicio/client - v7 — Prismic Docs

Your Role

Software engineer

Package.json file

We use

"@prismicio/client": "7.21.6", 
"@prismicio/next": "^2.2.1",
"@prismicio/react": "3.4.0",

Should we change how we query "next seven days"?

Hey Raphaelle!

this is expected. It’s because date.after includes anything after the start of the given date, not after the entire day.

So, when you use: date.after(..., "2026-04-19") it’s interpreted as “after 2026-04-19 at 00:00”.

So for example:

  • A page ending on 2026-04-19 at 10:00 will be included
  • A page ending on 2026-04-18 will not be included

Even though the event ends on the 19th, it’s still after the start of that day, so it matches the filter.

So yes, if you want to exclude everything that ended on the 19th, you can shift the filter to:

date.after(..., "2026-04-20")

Thank you @Pau !!
Can I just confirm whether or not this behaviour has always been "from start of day" vs "end of day"?
Just trying to figure out why we would have gone for it and make the changes required everywhere. (It's been that way for years)

Thank you!

date.after() hasn’t changed, this behavior has been consistent.

What’s happening is related to how the date is interpreted. When you use a date like "2026-04-19", it’s treated as the start of that day, so anything later on the 19th is still considered “after” and will be included.

OK, I'm not sure why we would've made that call, then. Thanks for confirming!