Skip to content

[EuiSuperDatePicker] Date validation is not locale aware #7704

Closed

Description

@sakurai-youhei

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.

Activity

  1. added
    ⚠️ needs validation
    on Apr 23, 2024
  2. removed
    ⚠️ needs validation
    on Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions