Skip to content

fix(components): [date-picker] keep disabled-date reactive in panels - #24708

Merged
patienry merged 4 commits into
element-plus:devfrom
lazerg:fix/24697-disabled-date-reactivity
Aug 13, 2026
Merged

patienry merged 4 commits into
element-plus:devfrom
lazerg:fix/24697-disabled-date-reactivity

Conversation

@lazerg

@lazerg lazerg commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Please make sure these boxes are checked before submitting your PR, thank you!

  • Make sure you follow contributing guide English | (中文 | Español | Français).
  • Make sure you are merging your commits to dev branch.
  • Add some descriptions and refer to relative issues for your PR.

fix #24697
fix #12633

panel-date-range.vue and use-panel-date-range.ts both pull disabledDate off pickerBase.props by destructuring, which snapshots the function once and drops reactivity. Replacing a disabled-date at runtime on a range picker therefore keeps the old predicate forever. Switched both to toRef(pickerBase.props, 'disabledDate'), the same thing the neighbouring format / shortcuts / defaultValue lines already do.

Extended the same fix to panel-date-pick.vue, panel-month-range.vue, panel-year-range.vue, and panel-quarter-range.vue, which had the identical destructure bug and were flagged in review.

Summary by CodeRabbit

  • Bug Fixes

    • Date picker panels now immediately reflect changes to date-disabling rules.
    • Updated date, month, quarter, and year selections consistently honor the latest disabled-date settings.
  • Tests

    • Added coverage verifying reactive disabled-date updates across all supported date picker types.

@github-actions

github-actions Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

@coderabbitai

coderabbitai Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: bd850719-4766-4661-b811-7d22819489b9

📥 Commits

Reviewing files that changed from the base of the PR and between 3d7be0d and 9078c0e.

📒 Files selected for processing (1)
  • packages/components/date-picker-panel/__tests__/date-picker-panel.test.tsx

📝 Walkthrough

Walkthrough

The date-picker panels now keep disabledDate as a reactive reference to picker props. Validation, normalization, navigation, and date searching use its current value. Parameterized tests verify updates across all supported picker types.

Changes

Date-picker disabled-date reactivity

Layer / File(s) Summary
Date-picker panel callback reactivity
packages/components/date-picker-panel/src/date-picker-com/panel-date-pick.vue
The main panel reads the current disabledDate callback during selection, confirmation, “now” handling, input validation, normalization, and keyboard navigation.
Date-range callback reactivity
packages/components/date-picker-panel/src/composables/use-panel-date-range.ts, packages/components/date-picker-panel/src/date-picker-com/panel-date-range.vue, packages/components/date-picker-panel/src/date-picker-com/panel-month-range.vue, packages/components/date-picker-panel/src/date-picker-com/panel-quarter-range.vue, packages/components/date-picker-panel/src/date-picker-com/panel-year-range.vue
Date-range panels use toRef for disabledDate and dereference it during date, month, quarter, and year validation and normalization.
Runtime callback regression tests
packages/components/date-picker-panel/__tests__/date-picker-panel.test.tsx
Parameterized tests verify that changing disabledDate updates disabled cells for all supported picker types.

Estimated code review effort: 2 (Simple) | ~10 minutes

Mergeability Score: ⚪ Minimal · up to 9078c

The change keeps runtime disabled-date updates reactive across date-picker panels. No actionable merge-blocking risk remains beyond normal checks and review.

Possibly related PRs

Suggested reviewers: lostelkbyte, rzzf, btea

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes address issue #24697 by preserving runtime disabled-date updates across the affected date-picker panels and adding regression coverage.
Out of Scope Changes check ✅ Passed All code and test changes support the linked issue and the stated goal of keeping disabled-date reactive in date-picker panels.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title clearly describes the main fix: preserving reactive disabled-date behavior in date-picker panels.
Description check ✅ Passed The description completes the template, explains the reactivity bug and fix, and references related issues.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

pnpm add https://pkg.pr.new/element-plus@24708
npm i https://pkg.pr.new/element-plus@24708
yarn add https://pkg.pr.new/element-plus@24708.tgz

commit: a632a61

@github-actions

github-actions Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Size Change: +131 B (+0.01%)

Total Size: 1.45 MB

📦 View Changed
Filename Size Change
dist/element-plus/dist/index.full.js 418 kB +27 B (+0.01%)
dist/element-plus/dist/index.full.min.js 293 kB +41 B (+0.01%)
dist/element-plus/dist/index.full.min.mjs 285 kB +24 B (+0.01%)
dist/element-plus/dist/index.full.mjs 408 kB +39 B (+0.01%)
ℹ️ View Unchanged
Filename Size
dist/element-plus/dist/index.css 47.6 kB

compressed-size-action

@github-actions

github-actions Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

🧪 Playground Preview: https://element-plus.run/?pr=24708
Please comment the example via this playground if needed.

🔖 Commit: a632a618ebf1314678889a56e9732dad3057304e

@patienry patienry 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.

Other pickers also have this issue (e.g. type="date"). It would be better to make the change consistently across all picker types.

@lazerg

lazerg commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

Good catch, thanks. Extended it.

panel-date-pick.vue had the same destructure, so date, datetime, week, month, year and quarter were all affected. The month, year and quarter range panels had it too. All of them now use toRef(pickerBase.props, 'disabledDate').

Added two regression tests: type="date" in date-picker.test.ts and type="datetime" in date-time-picker.test.tsx. Both fail on dev and pass with the change. Full unit suite is green (162 files, 2602 tests).

@lazerg lazerg changed the title fix(components): [date-picker] keep range panel disabled-date reactive fix(components): [date-picker] keep disabled-date reactive across picker panels Aug 11, 2026
@github-actions github-actions Bot added the CommitMessage::Unqualified Unqualified commit message label Aug 11, 2026
@lazerg lazerg changed the title fix(components): [date-picker] keep disabled-date reactive across picker panels fix(components): [date-picker] keep disabled-date reactive in panels Aug 11, 2026
@github-actions github-actions Bot removed the CommitMessage::Unqualified Unqualified commit message label Aug 11, 2026
@btea btea changed the title fix(components): [date-picker] keep disabled-date reactive in panels fix(components): [date-picker] keep disabled-date reactive in panels Aug 12, 2026

@patienry patienry 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.

Thank you!

@patienry
patienry merged commit 6988f96 into element-plus:dev Aug 13, 2026
17 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

@lazerg Thanks for your contribution! ❤️

@element-bot element-bot mentioned this pull request Aug 21, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

3 participants