-
Notifications
You must be signed in to change notification settings - Fork 843
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
[Series Charts] Provide custom crosshair overlay time formatting #1429
[Series Charts] Provide custom crosshair overlay time formatting #1429
Conversation
0477ba2
to
5d03a69
Compare
CHANGELOG.md
Outdated
@@ -4,6 +4,7 @@ No public interface changes since `6.3.0`. | |||
|
|||
## [`6.3.0`](https://github.com/elastic/eui/tree/v6.3.0) | |||
|
|||
- Added custom date string formatting for series charts crosshair overlay ([#1429](https://github.com/elastic/eui/pull/1429)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\This changelog entry is now out of date, needs to be moved back to the top
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in 7968372.
if (xType === SCALE.TIME || xType === SCALE.TIME_UTC) { | ||
return new Date(x).toISOString(); // TODO add a props for time formatting | ||
return moment(x).format(xCrosshairFormat); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either check to see that xCrosshairFormat
is passed through, or add a default value for the prop that matches the original implementation (otherwise xCrosshairFormat
is required and this is a breaking change for charts).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also updated in 7968372 - added tests in a later commit as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Summary
As a user of this component, we have encountered a case where we're expressing time in the current locality in other parts of our UI, but cannot change the locality or format of the date string displayed by the crosshair overlay when the mouse is used.
I've modified the existing code to use
moment.js
only because it seemed expedient to easily support this use case.Checklist