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

[Canvas] Display timestamp in the browser's timezone #33959

Closed
wick-ipedia opened this issue Mar 27, 2019 · 8 comments
Closed

[Canvas] Display timestamp in the browser's timezone #33959

wick-ipedia opened this issue Mar 27, 2019 · 8 comments
Labels
enhancement New value added to drive a business result Feature:Canvas impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. loe:large Large Level of Effort Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas

Comments

@wick-ipedia
Copy link

Describe the feature:

Make it possible within canvas to display timestamp in the browser’s timezone. I see the local() function in the moment.js docs, but I don’t think there is a way to access it in canvas.

Describe a specific use case for the feature:

Display timestamp in the browser's timezone.
When I pass a value to formatdate it is always converted to UTC or a hard coded timezone. Here is an example:

essql
query="SELECT max("@timestamp") time from "*"
WHERE "@timestamp" > NOW() - INTERVAL 5 MINUTES
AND "@timestamp" <= NOW()"
| markdown {getCell time | formatdate format="dddd, MMMM Do YYYY, h:mm:ss z"}
font={font family="'Open Sans', Helvetica, Arial, sans-serif" size=14 align="center" color="#FFFFFF" weight="normal" underline=false italic=false}
| render

@wick-ipedia wick-ipedia added enhancement New value added to drive a business result Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas labels Mar 27, 2019
@lukeelmers
Copy link
Member

A comment related to this issue was posted to the essql function PR as well. From what I can tell, whatever the user has set in Kibana's advanced setting dateFormat:tz is applied inconsistently depending on how you render the data:

With table:

filters
  | essql query = "
    SELECT HISTOGRAM(timestamp, INTERVAL 1 HOUR) as timestamp_hour, COUNT(*) as cnt
    FROM \"kibana_sample_data_flights\"
    GROUP BY timestamp_hour
    "
    tz="UTC+2"
  | table perPage=10
  | render

This will query ES as expected, and the returned data will have the correct UTC offset applied to timestamps:

    "rows": [
      {
        "timestamp_hour": "2019-04-01T02:00:00.000+02:00",
        "cnt": 10
      },
      {
        "timestamp_hour": "2019-04-01T03:00:00.000+02:00",
        "cnt": 9
      },
      {
        "timestamp_hour": "2019-04-01T04:00:00.000+02:00",
        "cnt": 15
      },
     ... etc

When timestamp_hour is parsed by moment js in table, it converts to whatever locale is specified in the advanced settings.

With plot:

filters
  | essql 
    query="
    SELECT HISTOGRAM(timestamp, INTERVAL 1 HOUR) as timestamp_hour, COUNT(*) as cnt
    FROM \"kibana_sample_data_flights\"
    GROUP BY timestamp_hour
    "
    tz="UTC+2"
  | pointseries x="timestamp_hour" y="cnt"
  | plot defaultStyle={seriesStyle points="0" bars="50000000" lines="0" color="#62bb96"}

The same response comes back, this time converted to an epoch timestamp, and passed to flot charts. It appears that flot is not actually converting to the timezone set in advanced settings, though this was a bit harder for me to test based on how the x axis values were displayed.

Testing the same query with the markdown function similarly results in the behavior @SpeechlessWick mentions above: the raw data from ES is displayed, with no timezone conversion based on the dateFormat:tz

@timductive timductive added the impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. label Jun 28, 2019
@bevano8
Copy link

bevano8 commented Sep 10, 2020

Is there no update on this?

@jtkarb jtkarb mentioned this issue Sep 10, 2020
15 tasks
@shneorc
Copy link

shneorc commented Oct 14, 2020

Is there an ETA for this fix?
Any workaround for timelion visualisation?

@cqliu1 cqliu1 added the loe:large Large Level of Effort label Dec 5, 2020
@cskowronnek
Copy link

Any news on this?

@derchirurg
Copy link

Any news?

@cskowronnek
Copy link

Any news on this?

@fgjensen
Copy link

Any new issue - Moment.js is outdated and Kibana should not use outdated libraries?

@ThomThomson
Copy link
Contributor

Closing this for the time being as we are currently not prioritizing Canvas enhancements. We can reopen this if it becomes such a nuisance that Canvas is unusable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New value added to drive a business result Feature:Canvas impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. loe:large Large Level of Effort Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas
Projects
None yet
Development

No branches or pull requests