mui-x icon indicating copy to clipboard operation
mui-x copied to clipboard

[pickers] Ensuring Comprehensive Validation for Date and DateTime Range Fields

Open bruns6077 opened this issue 1 year ago • 0 comments

Search Keywords

daterange, datetimerange, range validation, bug

Latest Version

  • [X] Tested on the latest version

Steps to Reproduce

Link to live example: Live Demo

Steps:

  1. Set a minDate for a DateRange or DateTimeRange.
  2. Choose a start value with at least minDate set and leave endDate blank.
  3. The field appears valid. However, for a range, both a startDate and an endDate are required, making the field invalid. This error should also be triggered on change in validationError.

Current Behavior

Currently, setting a startDate correctly validates the minDate and maxDate, except when an endDate is not specified, leading to incorrect validation that marks the field as valid.

Expected Behavior

Setting a startDate without specifying an endDate should result in an invalid field due to the missing endDate. It should also adhere to minDate and maxDate validations. A range requires both values, not just one.

Context

Ensuring correct validation for Date-Range or DateTime-Range fields.

Your Environment

No response

Order ID or Support Key 💳 (optional)

No response

bruns6077 avatar Feb 15 '24 18:02 bruns6077