Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EuiSuperDatePicker] Crashes and throws Invalid time value for edge case values #4777

Closed
jloleysens opened this issue May 4, 2021 · 5 comments
Labels
bug ⚠️ needs validation For bugs that need confirmation as to whether they're reproducible

Comments

@jloleysens
Copy link

Summary

Using the super time picker in Kibana can lead to UI crashing for edge case values (see elastic/kibana#91138).

How to reproduce

  1. Navigate here https://eui.elastic.co/#/forms/super-date-picker#configurations
  2. Select “days ago” and entering a value of 9 9s
  3. See error

Is there a recommended way to handle this outside of the elastic/eui lib such that we can not crash and guide users to the erroneous input?

Gif

supertimepickerbug

@jloleysens jloleysens added the bug label May 4, 2021
@cchaos cchaos added the ⚠️ needs validation For bugs that need confirmation as to whether they're reproducible label May 4, 2021
@cchaos cchaos changed the title Super date picker throws Invalid time value for edge case values [EuiSuperDatePicker] Throws Invalid time value for edge case values May 4, 2021
@hetanthakkar
Copy link
Contributor

hetanthakkar commented May 4, 2021

@cchaos Can we limit the characters the user type in the input field and set it to maybe 8 characters !? this might be the simplest fix?

@cchaos
Copy link
Contributor

cchaos commented May 4, 2021

Unfortunately, no, that isn't a valid fix. The problem isn't that they've type 9+ characters, the problem is that the component crashes. The component needs to gracefully handle user input error and not completely crash the UI. If an error surfaces as a result of user input, then the text field just needs to display as invalid and give feedback to the user.

@cchaos cchaos changed the title [EuiSuperDatePicker] Throws Invalid time value for edge case values [EuiSuperDatePicker] Crashes and throws Invalid time value for edge case values May 4, 2021
@hetanthakkar
Copy link
Contributor

hetanthakkar commented May 4, 2021

@cchaos Yeah i get it. I thought user would understand that if he can is allowed to enter just 8 digits that is the valid input!

@jloleysens
Copy link
Author

Can we limit the characters the user type in the input field and set it to maybe 8 characters !? this might be the simplest fix?

This is just one combination of user inputs that can lead the component to crashing. The underlying problem is that an Invalid Date is being created by going too far back in time and then we call toISOString to render the "Start date". If I had selected "years" I would need to enter fewer 9s for the crash to occur.

...the problem is that the component crashes. The component needs to gracefully handle user input...

++ to this!

@cchaos
Copy link
Contributor

cchaos commented Nov 15, 2021

Whoops, forgot to close this issue when #5263 merged. This has been fixed.
Screen Shot 2021-11-15 at 00 05 01 AM

@cchaos cchaos closed this as completed Nov 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug ⚠️ needs validation For bugs that need confirmation as to whether they're reproducible
Projects
None yet
Development

No branches or pull requests

3 participants