Skip to content

feat: add hour, minute, and second to DateInput for sub-day date filtering#3967

Merged
jasonbahl merged 1 commit into
mainfrom
feat/1234-subday-date-filtering
Jun 19, 2026
Merged

feat: add hour, minute, and second to DateInput for sub-day date filtering#3967
jasonbahl merged 1 commit into
mainfrom
feat/1234-subday-date-filtering

Conversation

@jasonbahl

Copy link
Copy Markdown
Collaborator

What

Adds hour, minute, and second (Int) fields to the DateInput type so a dateQuery's before/after bounds can constrain the time of day, not just the calendar day.

Why

DateInput only exposed year, month, and day. Because DateQueryInput.before/after are typed as DateInput, clients could not narrow a query to a sub-day window, even though WP_Query's date_query supports hour/minute/second on before/after natively. This is a long-standing, heavily requested ask (#1234).

How

Purely additive on the GraphQL input side. The new fields pass straight through Utils::map_input into WP_Query's date_query, so there is no resolver or query-cost change. The fields are optional, so existing queries are unaffected.

This is a non-breaking quick win toward the eventual ideal (a proper DateTime scalar input, deferred to the filter/sort RFC #1385). The decomposed fields stay optional and do not lock the schema in, so a future DateTime-scalar input can supersede DateInput cleanly.

Test

Regression test in PostObjectConnectionQueriesTest::testDateQueryAfterFiltersByHour: creates two posts on the same calendar day twelve hours apart, filters with an after bound of hour: 12, and asserts only the later post is returned. The test fails before the change (the hour field is rejected by GraphQL validation) and passes after.

Closes #1234

…ering

DateInput only exposed year, month, and day, so the before/after bounds of
a dateQuery could constrain the calendar day but not the time of day, even
though WP_Query's date_query supports hour/minute/second on before/after
natively.

Add hour, minute, and second (Int) to DateInput. This is purely additive on
the GraphQL input side: the values pass straight through to WP_Query, so no
resolver or query-cost change is needed.

This is a non-breaking quick win toward the ideal shape (a DateTime scalar
input, deferred to the filter/sort RFC). The three fields are optional and
do not lock the schema into the decomposed shape, so a future DateTime-scalar
input can supersede DateInput cleanly.

Closes #1234
@vercel

vercel Bot commented Jun 19, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
wpgraphql-com Skipped Skipped Jun 19, 2026 3:06am

@codecov

codecov Bot commented Jun 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.6%. Comparing base (4efed02) to head (3dbcc07).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##              main   #3967   +/-   ##
=======================================
  Coverage     83.5%   83.6%           
  Complexity    5330    5330           
=======================================
  Files          286     286           
  Lines        22848   22866   +18     
=======================================
+ Hits         19088   19106   +18     
  Misses        3760    3760           
Flag Coverage Δ
wp-graphql-acf-wpunit-twentytwentyfive-single 77.5% <ø> (ø)
wp-graphql-wpunit-twentytwentyfive-single 84.6% <100.0%> (+<0.1%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
plugins/wp-graphql/src/Type/Input/DateInput.php 100.0% <100.0%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jasonbahl jasonbahl merged commit f51aaa9 into main Jun 19, 2026
64 checks passed
@jasonbahl jasonbahl deleted the feat/1234-subday-date-filtering branch June 19, 2026 21:22
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.

Provide a way to query for posts before or after a specific time (not just date)

1 participant