Skip to content

[EuiDatePicker] Month/year dropdown selection bypasses maxDate/minDate constraint #9659

Closed

Description

@weronikaolejniczak

Reported by

@jillguyonnet

Describe the bug

When maxDate is passed to EuiDatePicker, selecting a month from the dropdown that would place the current day beyond maxDate fires onChange with the out-of-bounds date, which was presumably intended to notify consumers of a rejected selection:

setSelected = (date, event, keepInput) => {
let changedDate = date;
if (changedDate !== null && isDayDisabled(changedDate, this.props)) {
if (isOutOfBounds(changedDate, this.props)) {
this.props.onChange(date, event);
this.props.onSelect(changedDate, event);
}
return;
}

The same issue applies to minDate and to year dropdown selection.

Impact and severity

Potentially incorrect API calls and wrong data shown to the end-user. The impact and severity are medium.

File maxDate minDate onChange Bounds check in onChange
ml/.../create_calendar.tsx ✓ ✓ ✓ ✗
ml/.../time_range_picker.tsx ✓ ✗ ✓ ✗
ml/.../time_range_selector.js ✓ ✓ ✓ ✗
ml/.../new_event_modal.js ✗ ✗ ✓ ✓ (cross-date only)
ml/.../custom_time_range_picker.tsx ✗ ✗ ✓ ✗
ml/.../datafeed_chart_flyout.tsx ✗ ✗ ✓ ✗
fleet/.../go_to_date.tsx ✓ ✗ ✓ ✗
fleet/.../agent_upgrade_modal/index.tsx ✗ ✓ ✓ ✗
maintenance_windows/.../date_picker_range_field.tsx ✗ ✓ ✓ ✓ (cross-date only)
triggers_actions_ui/.../scheduler.tsx ✗ ✓ ✓ ✗ (isInvalid UI only)
triggers_actions_ui/.../recurrence_scheduler/index.tsx ✗ ✓ ✓ ✗
response-ops/.../snooze_duration_picker.tsx ✗ ✓ ✓ ✗
response-ops/.../rule_actions_alerts_filter_timeframe.tsx ✗ ✗ ✓ ✗
security_solution/.../protection_updates_layout.tsx ✓ ✓ ✓ ✓
security_solution/.../health_interval_filter.tsx ✓ ✓ ✓ ✗
security_solution/.../expire_time/index.tsx ✗ ✓ ✓ ✓ (past check only)
security_solution/.../threat_intelligence_...range_picker.tsx ✗ ✗ ✓ ✓ (cross-date only)
security_solution/.../schedule_bulk_action_modal/index.tsx ✗ ✗ ✓ ✗
infra/.../fixed_datepicker.tsx ✗ ✗ ✗ N/A (styled wrapper)
infra/.../waffle_time_controls.tsx ✗ ✗ ✓ ✗
observability/.../annotation_range.tsx ✗ ✗ ✓ ✗
observability/.../date_range_picker.tsx ✗ ✗ ✓ ✗
slo/.../purge_rollup_confirmation_modal.tsx ✗ ✗ ✓ ✗
agent_builder/.../esql_param_value_input.tsx ✗ ✗ ✓ ✗
agent_builder/.../test_tools.tsx ✗ ✗ ✓ ✗
cases/.../date_picker.tsx ✗ ✗ ✓ ✗
es_ui_shared/.../date_picker_field.tsx ✗ ✗ ✓ ✗
kbn-event-annotation-components/.../range_annotation_panel.tsx ✗ ✗ ✓ ✗
kbn-esql-editor/.../esql_editor.tsx ✗ ✗ ✓ ✗

Summary

Metric Count
Total usages 29
With maxDate 6
With minDate 10
With maxDate or minDate 12
With explicit maxDate/minDate bounds check in onChange 1
Relying entirely on EUI to enforce bounds 11

A known workaround is to re-validate the received date against maxDate/minDate inside the onChange handler (example). This duplicates the constraint that the component already accepts as a prop but is an acceptable workaround on consumer side in the meantime.

See also: elastic/kibana#180788

Environment and versions

  • EUI version: latest
  • React version: -
  • Kibana version (if applicable): -
  • Browser: -
  • Operating System: -

Minimum reproducible sandbox

Starting from any EuiDatePicker example on https://eui.elastic.co/, add:

<EuiDatePicker
  selected={selected}
  maxDate={moment().endOf('month')} // e.g. end of current month
  onChange={(date) => {
    console.log('onChange fired:', date?.format());
    setSelected(date);
  }}
/>

Open the month dropdown and select any month beyond the current one. Observe onChange is called with a date past maxDate, logged in the console.

To Reproduce

  1. Render an EuiDatePicker with a maxDate set to any date in the past or near future and an onChange that logs its argument.
  2. Open the calendar popover.
  3. Open the month dropdown and select a month that would place the currently selected day beyond maxDate (e.g. if maxDate is end of May and the selected day is the 15th, pick August).
  4. Observe that onChange fires with August 15, a date after maxDate, even though no day was clicked and August days are visually disabled.

Expected behavior

onChange should likely not fire when navigating months in a date that violates maxDate or minDate. The calendar should navigate to show the new month view but the selected value should remain unchanged until the user explicitly clicks a valid day.

Activity

  1. added
    ⚠️ needs validation
    and removed
    ⚠️ needs validation
    on May 14, 2026
  2. JasonStoltz commented on May 19, 2026

    @JasonStoltz
    Contributor

    We prioritized this at the top of our Do Next backlog assuming that it is a quick fix.

  3. self-assigned this
    on May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions