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

Convert timestamp quickvalues to formatted date #4423

Merged
merged 2 commits into from Dec 18, 2017
Merged

Convert timestamp quickvalues to formatted date #4423

merged 2 commits into from Dec 18, 2017

Conversation

@kroepke
Copy link
Member

@kroepke kroepke commented Dec 15, 2017

otherwise the search store will end up searching for the unix timestamp which is not supported

fixes #4288

…e to formatted date

otherwise the search store will end up searching for the unix timestamp which is not supported

fixes #4288
@kroepke kroepke added this to the 2.4.0 milestone Dec 15, 2017
@kroepke kroepke requested a review from edmundoa Dec 15, 2017
@ghost ghost assigned kroepke Dec 15, 2017
Copy link
Member

@edmundoa edmundoa left a comment

There are still a couple of changes we need to do, see inline comments.


if (this.props.field === 'timestamp') {
// convert unix timestamp to proper formatted value, so that add to search button works correctly
formattedTerm = moment.utc(Number(d.term)).format(DateTime.Formats.TIMESTAMP);

This comment has been minimized.

@edmundoa

edmundoa Dec 15, 2017
Member

This does not display date times in the user time zone, providing inconsistent values with the search results. We should use new DateTime(Number(d.term)).toString(DateTime.Formats.TIMESTAMP) to get the time formatted in the user's time zone.

columns.push(d => this._getAddToSearchButton(d.term));
if (this.props.field === 'timestamp') {
// convert unix timestamp to proper formatted value, so that add to search button works correctly
columns.push(d => this._getAddToSearchButton(moment.utc(Number(d.term)).format(DateTime.Formats.TIMESTAMP)));

This comment has been minimized.

@edmundoa

edmundoa Dec 15, 2017
Member

This also has problems with the user TZ, as the value from here is later converted into UTC (see gif below) and when pressing the search button we can't find any results. We should use, as in the other case new DateTime(Number(d.term)).toString(DateTime.Formats.TIMESTAMP) to convert the unix time in the user's selected time zone.

time

This comment has been minimized.

@edmundoa

edmundoa Dec 15, 2017
Member

By the way, as both date times should be formatted the same way, I would extract the conversion into a function for extra clarity.

extract repeated code into function
@bernd
Copy link
Member

@bernd bernd commented Dec 18, 2017

Moving to 3.0.0 milestone.

@bernd bernd modified the milestones: 2.4.0, 3.0.0 Dec 18, 2017
Copy link
Member

@edmundoa edmundoa left a comment

LGTM 👍

@edmundoa edmundoa merged commit b4af02b into master Dec 18, 2017
5 checks passed
5 checks passed
ci-web-linter Jenkins build graylog-pr-linter-check 2136 has succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
graylog-project/pr Jenkins build graylog-project-pr-snapshot 837 has succeeded
Details
license/cla Contributor License Agreement is signed.
Details
@ghost ghost removed the ready-for-review label Dec 18, 2017
@edmundoa edmundoa deleted the issue-4288 branch Dec 18, 2017
bernd added a commit that referenced this pull request Jan 24, 2018
* when displaying quick values for the timestamp field convert unix time to formatted date

otherwise the search store will end up searching for the unix timestamp which is not supported

fixes #4288

* respect timezones when stringifying

extract repeated code into function

(cherry picked from commit b4af02b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

3 participants