[Series Charts] Provide custom crosshair overlay time formatting#1429
Merged
justinkambic merged 8 commits intoJan 15, 2019
Merged
Conversation
0477ba2 to
5d03a69
Compare
31 tasks
chandlerprall
suggested changes
Jan 14, 2019
|
|
||
| ## [`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)) |
Contributor
There was a problem hiding this comment.
\This changelog entry is now out of date, needs to be moved back to the top
| const { xType, xCrosshairFormat } = this.props; | ||
| 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); |
Contributor
There was a problem hiding this comment.
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).
Contributor
Author
There was a problem hiding this comment.
Also updated in 7968372 - added tests in a later commit as well.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.jsonly because it seemed expedient to easily support this use case.Checklist