# Canvas date function time zone support

**URL:** https://discuss.elastic.co/t/canvas-date-function-time-zone-support/294485
**Category:** Kibana
**Tags:** canvas
**Created:** [January 15, 2022, 3:44pm UTC](https://discuss.elastic.co/t/canvas-date-function-time-zone-support/294485 "2022-01-15T15:44:29Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![fgjensen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fgjensen/32/62320_2.png) [@fgjensen](https://discuss.elastic.co/u/fgjensen)
#### Post date: [January 15, 2022, 3:44pm UTC](https://discuss.elastic.co/t/canvas-date-function-time-zone-support/294485/1 "2022-01-15T15:44:30Z")

</div>

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](https://momentjs.com/docs/#/displaying/) 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?

```auto
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

---

<div class="post-metadata">

### Author: ![ylasri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ylasri/32/86120_2.png) [@ylasri](https://discuss.elastic.co/u/ylasri)
#### Post date: [January 15, 2022, 5:18pm UTC](https://discuss.elastic.co/t/canvas-date-function-time-zone-support/294485/2 "2022-01-15T17:18:51Z")

</div>

This related to an old issue that's still pending 🙂

> <https://github.com/elastic/kibana/issues/33959>
>
> \*\*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

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

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/a/c/acf9b553a8e16f80e5eb3f751723a0c600c9d565.png)

```auto
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

```

---

<div class="post-metadata">

### Author: ![fgjensen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fgjensen/32/62320_2.png) [@fgjensen](https://discuss.elastic.co/u/fgjensen)
#### Post date: [January 16, 2022, 9:04am UTC](https://discuss.elastic.co/t/canvas-date-function-time-zone-support/294485/3 "2022-01-16T09:04:37Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [February 13, 2022, 9:04am UTC](https://discuss.elastic.co/t/canvas-date-function-time-zone-support/294485/4 "2022-02-13T09:04:46Z")

</div>

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