Skip to content

[6.x] Fix whereDate() and whereTime() when the app timezone is not UTC - #15338

Merged
jasonvarga merged 3 commits into
statamic:6.xfrom
lazerg:fix/issue-15336-wheredate-timezone
Sep 3, 2026
Merged

[6.x] Fix whereDate() and whereTime() when the app timezone is not UTC#15338
jasonvarga merged 3 commits into
statamic:6.xfrom
lazerg:fix/issue-15336-wheredate-timezone

Conversation

@lazerg

@lazerg lazerg commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

The Stache query builder never matches anything with whereDate() or whereTime() when app.timezone is set to something other than UTC. A knock-on effect is that scheduled entries stop getting published, since MinuteEntries is built on both of those methods.

The comparison value is normalised into the app timezone in Statamic\Query\Builder, but the indexed values are augmented dates and therefore in UTC. filterWhereDate() then calls startOfDay() on the UTC value, which lands on midnight UTC, while the comparison value sits at midnight in the app timezone. Those are two different instants, so with any non-zero offset the two sides can never line up. filterWhereTime() has the same problem: it applies the app timezone H:i:s string to a UTC value.

Converting the indexed value into the app timezone before comparing puts both sides on the same wall clock. Statamic\Query\IteratorBuilder carries a copy of the same logic, so search and item queries were affected too and are fixed alongside it.

Fixes #15336

@lazerg lazerg changed the title [6.x] Fix whereDate and whereTime on the Stache when the app timezone is not UTC [6.x] Fix whereDate() and whereTime() on the Stache when the app timezone is not UTC Sep 1, 2026
@lazerg lazerg changed the title [6.x] Fix whereDate() and whereTime() on the Stache when the app timezone is not UTC [6.x] Fix whereDate() and whereTime() when the app timezone is not UTC Sep 1, 2026
@jasonvarga
jasonvarga merged commit 8496370 into statamic:6.x Sep 3, 2026
62 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

whereDate() / whereTime() never match on the Stache when app.timezone is not UTC

2 participants