Canvas date function time zone support

Hello

I have some Canvas pages on which I want to show the last time the Canvas was reloaded.

Using the date function with a date formatted as shown below, the time zone is in UTC. The timezone setting in Kibana (7.16.2) is correct, so Canvas datetimes are not aligned with Kibana settings.

Reading the Moment.js documentation does not help much, since Moment.js seems to be deprecated and timezone support seems to require Moment.js add-ons.

Any Moment experts here who could provide help?

date
| formatdate "DD-MM-YYYY HH:mm:ss"
| markdown "Opdateret " {context}
  font={font family="'Open Sans', Helvetica, Arial, sans-serif" size=20 align="center"
    color="#FFFFFF"
    weight="normal"
    underline=false
    italic=false}
| render

I am also a bit astonished a leading application like Kibana uses Moment, since the project writes on its home page:

Moment was built for the previous era of the JavaScript ecosystem. The modern web looks much different these days.

Best regards
Flemming

This related to an old issue that's still pending :slight_smile:

In my case, all end users are in the same timezone, so i added 1 Hour in the SQL query (Temporary fix)

filters
| essql query="SELECT CAST(CURRENT_TIMESTAMP AS DATETIME) + INTERVAL 1 HOURS AS actual_datetime"
| mapColumn "actual_datetime" fn={getCell actual_datetime | formatdate "YYYY-MM-DD HH:mm:ss"}
| markdown "Current Timestamp {{#each rows}}{{actual_datetime}}{{/each}}"
| render

Hello @ylasri

Thanks for your example and for pointing me to the Github issue.

In my case all users are also in the same timezone, so I can apply the suggested solution. However, it would be a better solution, if the issue was fixed and the canvas could relay the browser's locale.

Several people ask for a patch on Github, so I would like to know from the Kibana developers what the plans are?

Best regards
Flemming

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.