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

[pickers] Ineffective Date and Time Validation Despite minTime, maxTime, and disableIgnoringDatePartForTimeValidation Settings

Open bruns6077 opened this issue 1 year ago • 1 comments

Search Keywords

datetimepicker, validation, issue

Latest Version

  • [X] I have tested this on the latest version.

Steps to Reproduce

Link to a live example: LiveDemo

Steps:

  1. Open the provided example.
  2. Review the parameters.
  3. Notice that setting disableIgnoringDatePartForTimeValidation to true appears ineffective.

Current Behavior

Enabling disableIgnoringDatePartForTimeValidation should ensure the date portion is considered during validation. However, it appears to be disregarded. When accessing the picker, it's evident that dates prior to the specified minTime are not disabled as expected. Furthermore, both the parameter and the validation process require correction, as disableIgnoringDatePartForTimeValidation currently does not produce the intended effect.

Expected Behavior

Setting a minTime or maxTime should result in the disabling of dates preceding the minTime and subsequent to the maxTime. Additionally, enabling disableIgnoringDatePartForTimeValidation is expected to incorporate the date into the validation process, taking both date and time into consideration.

Context

I aimed to limit the date selection using minTime and maxTime and to utilize their validation capabilities. Regrettably, this approach has proven ineffective. I have implemented disableIgnoringDatePartForTimeValidation to no avail.

Your Environment

No response

Order ID or Support Key 💳 (Optional)

No response

bruns6077 avatar Feb 15 '24 23:02 bruns6077

Hi,

Did you try using minDateTime and maxDateTime? IMHO disableIgnoringDatePartForTimeValidation should not be part of the public API, you should always be able to use minTime / maxTime if you don't want to impact the date part and minDateTime / maxDateTime if you do want to impact it.

flaviendelangle avatar Feb 16 '24 09:02 flaviendelangle

The issue has been inactive for 7 days and has been automatically closed.

github-actions[bot] avatar Feb 23 '24 10:02 github-actions[bot]