Repository navigation
Conversation
Mark days that have events with a dot, and add the number of events to their accessible label, like the `events` prop of the legacy `DatePicker`. Days are matched in the calendar's time zone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The calendar of the `datetime` control can now mark days with events, such as the days that already have posts. `getEvents` receives the item and the bounds of the displayed month, and runs again when the user navigates to another month. The compact control doesn't call it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Restores the markers the post date picker showed before the DataForm inspector became the default in #85081: days with published or scheduled posts of the same post type, the current post excluded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
04990c9 to
c902a7b
Compare
🤖 PR meta 🤖🎉 PropsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
Updated as activity occurs, without notifying anyone named here. Add the 🏷️ LabelsThis pull request needs exactly one label indicating its type, and has 0.
Read more about Type labels in Gutenberg. If you cannot add labels yourself, a reviewer can do it for you. 📦 Bundle sizeSize Change: +1.76 kB (+0.02%) Total Size: 8.59 MB 📦 View Changed
⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
🏁 Flaky testsSome tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information. Page List converts to Navigation Links with entity bindings in
|
There was a problem hiding this comment.
🟡 Changes recommended
Switching records within the same month can retain stale calendar events and apply results with the wrong exclusion ID, while the datepicker test can time out on the first day of a month.
2 open issues
What changed in this PR
Restores calendar markers for published and scheduled posts in the DataForm-based editor inspector and site editor Quick Edit, following the inspector migration in #85081.
Changes:
- Adds event dots and accessible event counts to
CalendarandRangeCalendar. - Adds month-based event loading to DataForm’s datetime control and connects the core date field to post queries.
- Adds regression coverage, a calendar story, and API documentation.
| File | Description |
|---|---|
test/e2e/specs/editor/various/datepicker.spec.js |
Tests post markers and month navigation. |
packages/ui/src/calendar/utils/use-events.ts |
Matches event dates and extends accessible labels. |
packages/ui/src/calendar/utils/constants.ts |
Registers the event modifier class. |
packages/ui/src/calendar/types.ts |
Defines the calendar events prop. |
packages/ui/src/calendar/test/range-calendar.jsdom.test.tsx |
Tests range-calendar event counts. |
packages/ui/src/calendar/test/calendar.jsdom.test.tsx |
Tests event counts and time-zone matching. |
packages/ui/src/calendar/style.module.css |
Styles event dots. |
packages/ui/src/calendar/stories/index.story.tsx |
Demonstrates calendars with events. |
packages/ui/src/calendar/range-calendar.tsx |
Integrates events into range calendars. |
packages/ui/src/calendar/calendar.tsx |
Integrates events into single-date calendars. |
packages/ui/CHANGELOG.md |
Documents calendar event support. |
packages/dataviews/src/types/field-api.ts |
Defines typed event-loader configuration. |
packages/dataviews/src/components/dataform-controls/utils/use-calendar-events.ts |
Loads events for the displayed month. |
packages/dataviews/src/components/dataform-controls/test/datetime.jsdom.test.tsx |
Tests loading, navigation, and compact-mode behavior. |
packages/dataviews/src/components/dataform-controls/datetime.tsx |
Passes loaded events to the calendar. |
packages/dataviews/README.md |
Documents getEvents usage. |
packages/dataviews/CHANGELOG.md |
Records datetime event-loading support. |
packages/core-fields/src/test/post-type-supports.jsdom.test.ts |
Tests the date field’s post query. |
packages/core-fields/src/post_type_supports/date/types.ts |
Adds optional post identity properties. |
packages/core-fields/src/post_type_supports/date/field.tsx |
Loads published and scheduled posts as events. |
Review effort: Balanced
| return () => { | ||
| isCurrent = false; | ||
| }; | ||
| }, [ getEvents, monthStart ] ); |
| await expect( | ||
| page.getByRole( 'button', { | ||
| // The first day of the month can be today. | ||
| name: new RegExp( `${ toDayLabel( thisMonth ) }, 1 event$` ), |
|
@WordPress/gutenberg-design Can we settle on a design first? I see we've had some discussion in the past (for example here). |
|
The Storybook check fails because the components manifest snapshot was not updated for the new events prop. I guess running |
| requestUtils, | ||
| } ) => { | ||
| // Dates in the site time zone, which the calendar displays. | ||
| const now = new Date(); |
There was a problem hiding this comment.
I think this test can be flaky for contributors whose machines are not in UTC. new Date() runs in the runner timezone while the calendar opens on the month of the site timezone, so near a month boundary the expected month and the displayed month can differ. Should we pin the site timezone in a beforeAll like the describes above do, and build these dates with Date.UTC so the local timezone is not part of the math?
| pointer-events: none; | ||
| } | ||
|
|
||
| .root[dir="rtl"] .events::before { |
There was a problem hiding this comment.
Minor non blocker: other primitives center with a physical left plus a stylelint disable comment because the centering technique works the same in RTL, e.g: the radio, checkbox and dialog styles. What do you think of using that pattern here? It would remove the need for the [dir="rtl"] override.
jorgefilipecosta
left a comment
There was a problem hiding this comment.
Nice work, it is great to have the day markers back! I tested the PR locally and the days with posts are marked correctly both in the post editor and in quick edit, the current post is excluded, and the dates are handled in the site timezone, which is an improvement over the legacy picker that parsed them in the browser timezone. I left some minor comments but I don't think any of them is a blocker.
|
We still need to fix this for the default |
|
Opened #86538 to discuss visual and API design |



What?
Follow up to #85081. Fixes the regression reported in #76076 (comment).
Since 24.3, the Date control in the post summary no longer marks the days that already have published or scheduled posts. This PR brings the markers back, in the post editor inspector and in the site editor's Quick Edit.
Why?
#85081 made the DataForm-based inspector the default in 24.3. The old picker (
packages/editor/src/components/post-schedule/index.jsx) queried the published and scheduled posts of the displayed month and passed them toDatePickerasevents. The DataFormdatetimecontrol renders theCalendarfrom@wordpress/ui, and neither of them had a way to mark days, so the markers were lost. Sites that schedule regularly use them to see at a glance which days are still free.How?
Three layers, each in its own commit:
@wordpress/ui:CalendarandRangeCalendarget aneventsprop ({ date: Date }[], the shape of the legacyDatePickerprop). A day with events shows a dot below its number, and its accessible label gains the count (e.g. "Monday, November 2, 2026, 1 event"). Days are matched in the calendar'stimeZone. The dot usescurrentColor, like the today dot, so it adapts to selected days and forced-colors mode.@wordpress/dataviews: thedatetimeEdit config getsgetEvents, an async loader likegetElements. It receives{ item, from, to }, the bounds of the displayed month in the calendar's time zone, and runs again when the user navigates to another month, not on every edit of the item. The compact control (no calendar) doesn't call it.@wordpress/core-fields: thedatefield usesgetEventsto load the published and scheduled posts of the same post type in the displayed month, excluding the current post. This is the same query the old picker ran. Because the field lives incore-fields, every DataForm that uses it gets the markers, Quick Edit included.An e2e test in
datepicker.spec.jscovers the regression.Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast
Published and scheduled posts this month; today is November 3.
Before this PR (since 24.3), the same calendars show no dots.
Use of AI Tools
This PR was written with Claude Code (Claude Opus 5.5).