Skip to content

feat: add disabled dates API to date and date-time pickers#9691

Open
Artur- wants to merge 3 commits into
mainfrom
feature/disable-dates
Open

feat: add disabled dates API to date and date-time pickers#9691
Artur- wants to merge 3 commits into
mainfrom
feature/disable-dates

Conversation

@Artur-

@Artur- Artur- commented Jul 7, 2026

Copy link
Copy Markdown
Member

Add server-side disabled-dates support: setDisabledDates for a fixed list, setDisabledWeekdays, and a DisabledDatesProvider callback that is called per date. The connector composes these into the web component's disabledDatesProvider (static rules client-side, the provider via a @ClientCallable range request evaluated per date on the server) and the validator rejects disabled values. DateTimePicker delegates the same API to its date part.

Part of vaadin/platform#2867

Add server-side disabled-dates support: setDisabledDates for a fixed
list, setDisabledWeekdays, and a DisabledDatesProvider callback that is
called per date. The connector composes these into the web component's
disabledDatesProvider (static rules client-side, the provider via a
@ClientCallable range request evaluated per date on the server) and the
validator rejects disabled values. DateTimePicker delegates the same API
to its date part.

Part of #2867
@Artur-

Artur- commented Jul 7, 2026

Copy link
Copy Markdown
Member Author

com.vaadin.flow.component.datepicker.DatePicker

// Added
public void setDisabledDates(Collection<LocalDate> dates) // fixed set of dates that cannot be selected
public Set<LocalDate> getDisabledDates()
public void setDisabledWeekdays(Set<DayOfWeek> weekdays) // e.g. disable weekends
public Set<DayOfWeek> getDisabledWeekdays()
public void setDisabledDatesProvider(DatePicker.DisabledDatesProvider provider) // per-date, server-evaluated
public DatePicker.DisabledDatesProvider getDisabledDatesProvider()

com.vaadin.flow.component.datepicker.DatePicker.DisabledDatesProvider

// Added
@FunctionalInterface
public interface DisabledDatesProvider extends Serializable
boolean isDisabled(LocalDate date) // true to disable the given date

com.vaadin.flow.component.datepicker.DatePicker.DatePickerI18n

// Added
public String getDateDisabledErrorMessage()
public DatePicker.DatePickerI18n setDateDisabledErrorMessage(String errorMessage)

com.vaadin.flow.component.datetimepicker.DateTimePicker

// Added
public void setDisabledDates(Collection<LocalDate> dates) // delegates to the date part
public Set<LocalDate> getDisabledDates()
public void setDisabledWeekdays(Set<DayOfWeek> weekdays)
public Set<DayOfWeek> getDisabledWeekdays()
public void setDisabledDatesProvider(DatePicker.DisabledDatesProvider provider)
public DatePicker.DisabledDatesProvider getDisabledDatesProvider()

The while loop mutated the loop variable via date.setDate(), which
Sonar (rule S2189) reports as a potential infinite loop. Use a counted
for loop instead.
@Artur- Artur- changed the title feat: add disabled dates API to date and date-time pickers feat: add disabled dates API to date pickers Jul 7, 2026
@Artur- Artur- changed the title feat: add disabled dates API to date pickers feat: add disabled dates API to date and date-time pickers Jul 7, 2026
Point every @vaadin NpmPackage annotation at the feature snapshot
25.3.0-dev.3a3c2d7d2a (dist-tag dev-disable-dates) to test the flow
integration against the disabled dates web component changes.

@vaadin-review-bot vaadin-review-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This PR updates the @NpmPackage version. Because the default value of vaadin.npm.minimumFrontendPackageAgeDays is 1, I'm blocking it for now to avoid producing a failed snapshot for other projects.

No action needed — this is fully automated:

  • I posted this block automatically when CI detected the @NpmPackage version bump.
  • 24 hours after this message, I will automatically dismiss this review, approve the PR, and enable auto-merge (squash) so it merges as soon as all required checks pass.

What affects the 24h timer:

  • New commits / pushes do not reset it — the countdown is anchored to this message, so it keeps running no matter how many times you push.
  • The timer only restarts if this block review is manually dismissed and a later CI run detects an @NpmPackage bump again (that posts a fresh block).
  • If the PR is merged or closed before the 24 hours elapse, the auto-unblock simply does nothing.

@sonarqubecloud

sonarqubecloud Bot commented Jul 8, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
D Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@vaadin-review-bot
vaadin-review-bot dismissed their stale review July 9, 2026 09:58

24 hours have passed since the @NpmPackage block. Auto-unblocking and approving.

@vaadin-review-bot vaadin-review-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Automatically approved 24 hours after the @NpmPackage version bump block.

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.

2 participants