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] Date validation is not locale aware #7704

Closed
sakurai-youhei opened this issue Apr 23, 2024 · 0 comments · Fixed by #7705
Closed

[EuiSuperDatePicker] Date validation is not locale aware #7704

sakurai-youhei opened this issue Apr 23, 2024 · 0 comments · Fixed by #7705
Labels

Comments

@sakurai-youhei
Copy link
Member

Describe the bug

The date string at the bottom of the absolute tab changes with respect to a locale such as ja-JP. However, the date string fails to pass validation unless rewriting it in the en locale.

Here is a GIF animation showing the validation failure on Kibana 8.12.2 with i18n.locale: ja-JP. Both 3月 and 4月 are valid MMM in Japanese, but EuiSuperDatePicker accepts neither. It accepts only MMM in English, such as Apr.
323864440-03e4b45c-0a4e-46a0-8bb4-58a6e8a3728d

Impact and severity

The impact is probably limited because only non-English locales make this observable. The workaround is to rewrite the date string in English manually.

Environment and versions

  • EUI version: 94.1.0 (main branch)
  • React version: 18.2.0
  • Kibana version: at least 8.11.0+
  • Browser: Chrome Version 123.0.6312.124 (Official Build) (64-bit)
  • Operating System: Windows 11 10.0.22621 N/A Build 22621

To Reproduce

<EuiSuperDatePicker
  start="now-1h"
  end="now-15m"
  locale="ja-JP"
  dateFormat="MMM D, YYYY @ HH:mm:ss.SSS"
  onTimeChange={onTimeChange}
/>

With the EuiSuperDatePicker above,

  1. Show the absolute tab.
  2. Change the year 2024 to e.g. 2023.
  3. Hit Enter.

Expected behavior

It should hide the following message.

Allowed formats: MMM D, YYYY @ HH:mm:ss.SSS, ISO 8601, RFC 2822, or Unix timestamp.

Additional context

I will open a PR shortly.

@sakurai-youhei sakurai-youhei added bug ⚠️ needs validation For bugs that need confirmation as to whether they're reproducible labels Apr 23, 2024
@cee-chen cee-chen removed the ⚠️ needs validation For bugs that need confirmation as to whether they're reproducible label Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants