Repository navigation
feat: add disabled dates and weekdays to DatePicker - #9862
Merged
Merged
Conversation
Static disabled-date rules are evaluated in the browser through the web component's isDateDisabled property, so they cost no server round trip. They are pushed to the connector as [year, month, day] triples with a zero-based month, and as ISO weekday numbers, matching the encodings the web component already uses. The weekday check uses the web component's createDate helper rather than the Date constructor, which maps years below 100 into the 20th century. First step of the disabled dates feature. The date metadata provider and DateTimePicker support follow separately. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
web-padawan
marked this pull request as ready for review
August 10, 2026 14:50
vaadin-review-bot
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed the changes — left 3 comments.
| Finding | |
|---|---|
| 🧹 | The clearCache parameter, pendingCacheClear field, and clearCache JS call are dead code — no caller ever passes true. |
| ⚡ | The isDateDisabled closure always does both the date-key lookup and a Date allocation per cell, even when only one of the two sets is configured. |
| 🧹 | requestDateMetadataUpdate re-implements the exact debounce structure of the existing requestI18nUpdate. |
The clearCache parameter, the pendingCacheClear field and the client call they guarded had no caller that passed true, so the path could never run. They belong with the date metadata provider that needs them and come back together with it. The connector now runs only the checks that are actually configured. The web component calls isDateDisabled for every calendar cell on every render, so with only disabled dates set no Date is allocated per cell, and with only disabled weekdays set no key string is built. The i18n and date metadata updates now share one scheduling helper instead of repeating the same coalescing logic.
Both setters described how the constraint is applied in the browser and pointed at a date metadata provider that this version does not have yet. The first is an implementation detail, the second is a reference to an API that does not exist, so both are dropped. The null element behavior was only mentioned in prose inside @PARAM. It is now documented with @throws, which is what the tests assert.
DiegoCardoso
approved these changes
Aug 11, 2026
|
Collaborator
|
This ticket/PR has been released with Vaadin 25.3.0-alpha9. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Date Picker could only restrict selection with
minandmax, so a continuous range. Applications often need to block individual dates, such as public holidays or days that are already fully booked, and recurring weekdays, such as weekends.This adds the two static constraints:
Disabled dates render as disabled in the overlay and cannot be selected, and entering one by hand marks the field invalid with
DatePickerI18n.setDisabledDateErrorMessage(...).Changes
Both constraints are evaluated in the browser through the web component's
isDateDisabledproperty, so neither costs a server round trip. The rules are pushed to the connector as[year, month, day]triples with a zero-based month, and as ISO weekday numbers, which are the encodings the web component already uses — so the connector parses nothing.The trade-off is that the set is sent to the browser in full every time the configuration is updated, including on every attach. The Javadoc says so and points to the upcoming provider for large or changing sets.
onAttachskips the update entirely when nothing is configured, so components that do not use the feature send nothing.The weekday check uses the web component's
createDatehelper rather thannew Date(year, month, day), which maps years below 100 into the 20th century and would report the wrong weekday for them.The new validation runs after the
minandmaxchecks, so a date that is both out of range and disabled still reports the min/max message.Scope
This PR covers the two static constraints only. Separate PRs follow for:
dateMetadataProvider, for rules that need the server and for custom part namesPart of vaadin/platform#2867
🤖 Generated with Claude Code