eui icon indicating copy to clipboard operation
eui copied to clipboard

[EuiDatePicker] Doesn't let you set a minDateTime

Open Zacqary opened this issue 5 years ago • 8 comments

There's no easy way to set EuiDatePicker with the timepicker enabled to set a minimum date and time. You can do:

(If it's Aug 15 2019 at 5:30pm)

<EuiDatePicker
  minDate={moment()}
  minTime={moment()}

But that will prevent a user from selecting any time before 5:30pm on August 16, 17, 18, etc. as well.

To achieve the desired result, you have to do a weird workaround like:

<EuiDatePicker
  selected={selectedTime}
  minDate={moment()}
  minTime={selectedTime.isSame(moment(), 'day')
    ? moment() 
    : moment.hour(0).minutes(0)
  }

Zacqary avatar Aug 15 '19 22:08 Zacqary

It's a valid point, for sure. It would necessitate a new prop, I think, because the current behavior of minDate and minTime is as intended (and pretty clear).

thompsongl avatar Aug 16 '19 20:08 thompsongl

👋 Hey there. This issue hasn't had any activity for 180 days. We'll automatically close it if that trend continues for another week. If you feel this issue is still valid and needs attention please let us know with a comment.

github-actions[bot] avatar Mar 19 '21 08:03 github-actions[bot]

Leaving open as a TODO during the re-write of the component.

cchaos avatar Mar 19 '21 18:03 cchaos

👋 Hey there. This issue hasn't had any activity for 180 days. We'll automatically close it if that trend continues for another week. If you feel this issue is still valid and needs attention please let us know with a comment.

github-actions[bot] avatar Sep 16 '21 00:09 github-actions[bot]

👋 Hey there. This issue hasn't had any activity for 180 days. We'll automatically close it if that trend continues for another week. If you feel this issue is still valid and needs attention please let us know with a comment.

github-actions[bot] avatar Mar 15 '22 16:03 github-actions[bot]

👋 Hey there. This issue hasn't had any activity for 180 days. We'll automatically close it if that trend continues for another week. If you feel this issue is still valid and needs attention please let us know with a comment.

github-actions[bot] avatar Sep 12 '22 00:09 github-actions[bot]

❌ We're automatically closing this issue due to lack of activity. Please comment if you feel this was done in error.

github-actions[bot] avatar Sep 19 '22 00:09 github-actions[bot]

This still seems valid.

cee-chen avatar Sep 19 '22 14:09 cee-chen

Due to the age of the issue and the valid workaround provided in the issue description, we're closing this as not planned. We'll gladly accept a PR, though.

daveyholler avatar Mar 27 '23 17:03 daveyholler