Skip to content

[scheduler] Add regression tests for standalone month names in headers - #22841

Merged
rita-codes merged 1 commit into
mui:masterfrom
adamowski10:standalone-month-header-scheduler
Oct 29, 2026
Merged

rita-codes merged 1 commit into
mui:masterfrom
adamowski10:standalone-month-header-scheduler

Conversation

@adamowski10

@adamowski10 adamowski10 commented Jun 16, 2026 •

Copy link
Copy Markdown
Contributor

Context

In locales with grammatical month forms (Polish, Czech, Russian, Finnish, etc.), the calendar headers used to show the genitive month name, e.g. "czerwca 2026" instead of "czerwiec 2026" in Polish.

This was fixed by #24021: the headers now format the month and the year with Intl ({ month: 'long', year: 'numeric' }), which picks the standalone form on its own, while day-with-month formats such as "1 czerwca" keep the genitive.

This PR started as a fix for that bug. After #24021, only the regression tests remain, so nothing guards the standalone-vs-genitive distinction otherwise.

Changes

  • date-locale.test.ts: formatMonthAndYear returns "lipiec 2025" for pl-PL and "červenec 2025" for cs-CZ
  • EventCalendar.test.tsx: the header shows "czerwiec 2026" when dateLocale="pl-PL"

Test plan

  • pnpm test:unit --project "x-scheduler*" --run
  • pnpm eslint
  • pnpm prettier

@code-infra-dashboard

code-infra-dashboard Bot commented Jun 16, 2026 •

Copy link
Copy Markdown

Deploy preview

https://deploy-preview-22841--material-ui-x.netlify.app/
QR code for https://deploy-preview-22841--material-ui-x.netlify.app/

Bundle size

Bundle Parsed size Gzip size
@mui/x-data-grid 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-pro 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-premium 0B(0.00%) 0B(0.00%)
@mui/x-charts 0B(0.00%) 0B(0.00%)
@mui/x-charts-pro 0B(0.00%) 0B(0.00%)
@mui/x-charts-premium 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers-pro 0B(0.00%) 0B(0.00%)
@mui/x-tree-view 0B(0.00%) 0B(0.00%)
@mui/x-tree-view-pro 0B(0.00%) 0B(0.00%)
@mui/x-scheduler 0B(0.00%) 0B(0.00%)
@mui/x-scheduler-premium 0B(0.00%) 0B(0.00%)
@mui/x-chat 0B(0.00%) 0B(0.00%)
@mui/x-license 0B(0.00%) 0B(0.00%)

Details of bundle changes


Check out the code infra dashboard for more information about this PR.

@zannager zannager added the scope: scheduler Changes related to the scheduler. label Jun 22, 2026
@rita-codes rita-codes added the type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. label Jun 29, 2026
@rita-codes

Copy link
Copy Markdown
Member

Thanks a lot for the contribution! 🙌

The change itself is correct — the standalone-vs-formatting month distinction and the scheduler call-site changes are exactly right.

One thing about where it should live: our scheduler adapter (base-ui-copy/...) is currently a manual copy of Base UI's temporal adapter, and the plan is to consume Base UI's adapter directly instead. So any change to the adapter contract needs to land in mui/base-ui first — otherwise it diverges from upstream and gets overwritten the next time we sync.

So monthFullLetterStandalone should be added to the temporal adapter in Base UI first. Once that's merged and synced here, this PR keeps just the scheduler-specific parts (header/agenda/timeline call-sites + EventCalendar tests).

Would you like to open that Base UI PR yourself? Happy to review it there — otherwise I can take care of it, no problem.

@adamowski10

Copy link
Copy Markdown
Contributor Author

Thanks a lot for the contribution! 🙌

The change itself is correct — the standalone-vs-formatting month distinction and the scheduler call-site changes are exactly right.

One thing about where it should live: our scheduler adapter (base-ui-copy/...) is currently a manual copy of Base UI's temporal adapter, and the plan is to consume Base UI's adapter directly instead. So any change to the adapter contract needs to land in mui/base-ui first — otherwise it diverges from upstream and gets overwritten the next time we sync.

So monthFullLetterStandalone should be added to the temporal adapter in Base UI first. Once that's merged and synced here, this PR keeps just the scheduler-specific parts (header/agenda/timeline call-sites + EventCalendar tests).

Would you like to open that Base UI PR yourself? Happy to review it there — otherwise I can take care of it, no problem.

Sure 😊
Here it is: mui/base-ui#5164

@github-actions github-actions Bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Jul 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@rita-codes

Copy link
Copy Markdown
Member

Thanks again for taking care of the Base UI side! mui/base-ui#5164 is merged now 🎉

Quick update on where things stand here: since this PR was opened we dropped the manual base-ui-copy in #21972, and the scheduler now consumes the temporal adapter directly from @base-ui/react/internals/temporal. That's why the PR shows conflicts: the adapter files it touches no longer exist.

monthFullLetterStandalone isn't in a published Base UI release yet (v1.8.0 went out before the merge), so the next steps are on our side:

  1. Wait for the next Base UI release that includes [DataGrid] Hide vertical scrollbar if autoHeight is enabled #5164.
  2. Bump @base-ui/react in the workspace catalog.
  3. Rebase this PR so only the scheduler-specific parts remain (call sites + EventCalendar tests), and cover the SidePanelDrawer header too, which started using monthFullLetter after this PR was opened.

I'll ping here once the bump lands so we can rebase and get this merged. Thanks a lot for your contribution! 🙌

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

This pull request has been inactive for 30 days. Please remove the stale label or leave a comment to keep it open. Otherwise, it will be closed in 15 days.

@github-actions github-actions Bot added the stale Inactive for 7 days (issues) or 30 days (PRs); closed after 5 or 15 more days if no update. label Oct 9, 2026
@rita-codes rita-codes removed the stale Inactive for 7 days (issues) or 30 days (PRs); closed after 5 or 15 more days if no update. label Oct 12, 2026

@flaviendelangle flaviendelangle left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR review

No merge-blocking issues found; one redundant test is worth removing. Verified head 46dbf99a9da107287935da773e6489e0b9d7cbb3. Targeted jsdom tests passed: 28 passed, with one browser-only test skipped.

Bugs (0)

No findings.

Tests (1)

1. 🟡 Remove the redundant adapter composition test

Location: packages/x-scheduler-internals/src/use-adapter/useAdapter.test.ts:57

expect(
  adapterPl.formatByString(june, `${f.monthFullLetterStandalone} ${f.yearPadded}`),
).to.equal(adapterPl.formatByString(june, `LLLL ${f.yearPadded}`));

This case constructs both patterns inside the test and compares equivalent calls to the same formatter. The preceding table already verifies the token mappings, while the new date-utils tests exercise production pattern selection. This case adds no independent regression coverage.

Failure scenario: These assertions still pass with the pre-fix scheduler helper returning czerwca 2026, as verified locally, because they never call that helper.

Fix: Remove this case and retain the adapter mapping, production helper, and calendar integration tests.

Simplifications (0)

No findings.

Docs (0)

No findings.

Verdict

Approve after nits - only redundant test coverage needs cleanup.


🤖 Review generated with Codex

@rita-codes

Copy link
Copy Markdown
Member

@adamowski10 good news: the Base UI bump landed in #23855, so monthFullLetterStandalone is now available from @base-ui/react/internals/temporal 🎉

Could you rebase on master? After the rebase, this PR should only need:

  • Drop the changes to the base-ui-copy adapter and types (that folder no longer exists). The adapter test can go too, since Base UI covers it now.
  • Update test/utils/scheduler/adapters.ts so adapterPl / adapterCs use the adapter from @base-ui/react/internals/temporal.
  • Keep the call sites (HeaderToolbar, AgendaView, date-utils, preset-utils) and the EventCalendar tests.
  • Also switch the month title in SidePanelDrawer.tsx to monthFullLetterStandalone.

If you don't have time for it, just let us know and we can take care of the rebase ourselves, no problem at all. Thanks for your patience on this one! 🙌

@adamowski10
adamowski10 force-pushed the standalone-month-header-scheduler branch from 46dbf99 to a9bb7a3 Compare October 28, 2026 13:26
@github-actions github-actions Bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Oct 28, 2026
@adamowski10

Copy link
Copy Markdown
Contributor Author

@adamowski10 good news: the Base UI bump landed in #23855, so monthFullLetterStandalone is now available from @base-ui/react/internals/temporal 🎉

Could you rebase on master? After the rebase, this PR should only need:

* Drop the changes to the `base-ui-copy` adapter and types (that folder no longer exists). The adapter test can go too, since Base UI covers it now.

* Update `test/utils/scheduler/adapters.ts` so `adapterPl` / `adapterCs` use the adapter from `@base-ui/react/internals/temporal`.

* Keep the call sites (`HeaderToolbar`, `AgendaView`, `date-utils`, `preset-utils`) and the `EventCalendar` tests.

* Also switch the month title in `SidePanelDrawer.tsx` to `monthFullLetterStandalone`.

If you don't have time for it, just let us know and we can take care of the rebase ourselves, no problem at all. Thanks for your patience on this one! 🙌

Rebased on master and applied all the changes, including SidePanelDrawer. Thanks!

@github-actions github-actions Bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Oct 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@adamowski10

Copy link
Copy Markdown
Contributor Author

@rita-codes I rebased on master, and it turns out #24021 already fixed the bug. The headers now format the month and year with Intl ({ month: 'long', year: 'numeric' }), which picks the standalone form on its own: "czerwiec 2026" in Polish, while "1 czerwca" keeps the genitive. So none of the call-site changes from this PR are needed anymore. If I'm correct?

I could reduce this PR to two regression tests:

  • date-locale.test.ts: formatMonthAndYear returns "lipiec 2025" for pl-PL and "červenec 2025" for cs-CZ
  • EventCalendar.test.tsx: the header shows "czerwiec 2026" with dateLocale="pl-PL"

Would you like me to push that, or should I just close the PR? Either is fine with me 🙂

@rita-codes

Copy link
Copy Markdown
Member

@adamowski10 you're right, nice catch!

We've been making some big changes around the adapter lately and your PR got caught in the middle. The upside is that this is exactly the kind of locale bug the new approach makes much harder to introduce, so it's great to see it disappear on its own.

The regression tests are still very welcome though: date-locale.test.ts only covers en-US and fa-IR today, and nothing guards the standalone-vs-genitive distinction. Please push them, the two you listed are exactly what I'd add. Could you also update the PR title and description to reflect the new scope?

Thanks for sticking with this one! 🙌

Locales such as Polish and Czech inflect the month name when it follows a
day ("13 czerwca") but use the nominative form on its own ("czerwiec 2026").
The headers now format the month and the year with Intl, which picks the
standalone form, so these tests guard against regressing to the genitive.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@adamowski10
adamowski10 force-pushed the standalone-month-header-scheduler branch from a9bb7a3 to 4afd03c Compare October 29, 2026 08:08
@github-actions github-actions Bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Oct 29, 2026
@adamowski10 adamowski10 changed the title [scheduler] Use standalone month format for calendar headers [scheduler] Add regression tests for standalone month names in headers Oct 29, 2026
@adamowski10

Copy link
Copy Markdown
Contributor Author

@rita-codes Pushed, and updated the title and description. Thanks! 👏

@rita-codes
rita-codes merged commit ff497b3 into mui:master Oct 29, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: scheduler Changes related to the scheduler. type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants