# Kibana custom plugin default timezone

**URL:** <https://discuss.elastic.co/t/kibana-custom-plugin-default-timezone/174593>\
**Category:** Kibana\
**Created:** [March 29, 2019, 6:21pm UTC](https://discuss.elastic.co/t/kibana-custom-plugin-default-timezone/174593 "2019-03-29T18:21:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bbking](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bbking/32/77563_2.png) [@bbking](https://discuss.elastic.co/u/bbking)\
**Post date:** [March 29, 2019, 6:21pm UTC](https://discuss.elastic.co/t/kibana-custom-plugin-default-timezone/174593/1 "2019-03-29T18:21:34Z")

</div>

Hi, is there a way to set a default timezone in a custom Kibana plugin?  
The timezone in front end can be use by `import 'ui/autoload/settings'` in app.js.  
Is there similar ways to set it up on server side of the plugin app?

---

<div class="post-metadata">

**Author:** ![tsullivan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tsullivan/32/31077_2.png) [@tsullivan](https://discuss.elastic.co/u/tsullivan)\
**Post date:** [March 29, 2019, 10:03pm UTC](https://discuss.elastic.co/t/kibana-custom-plugin-default-timezone/174593/2 "2019-03-29T22:03:40Z")

</div>

Hi,

Your code will have to get a handle to the uiSettings service. That can be done on the server-side using a factory method off `request`:

```auto
  server.route({
    path: `${MAIN_ENTRY}/timezone`,
    method: 'GET',
    handler: async (request) => {
      // get a setting:
      const timezone = await request.getUiSettingsService().get('dateFormat:tz');     

      // set a setting:
      const uiSettings = request.getUiSettingsService();
      await uiSettings.set('dateFormat:tz','UTC');
    },
  });

```

---

<div class="post-metadata">

**Author:** ![bbking](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bbking/32/77563_2.png) [@bbking](https://discuss.elastic.co/u/bbking)\
**Post date:** [April 1, 2019, 4:52pm UTC](https://discuss.elastic.co/t/kibana-custom-plugin-default-timezone/174593/3 "2019-04-01T16:52:32Z")

</div>

Hi Tim, thanks for your response! I probably didn't explain my question well. My question is about how to set a default timezone on server side. Is there a way to load the timezone setting from kibana.yml `logging.timezone` or `uiSetting` in the backend? Currently, the front-end timezone is sync with uiSetting but the backend timezone is still UTC. Is there an easy way to set the default-timezone without adding extra node modules?

---

<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:** [April 29, 2019, 4:52pm UTC](https://discuss.elastic.co/t/kibana-custom-plugin-default-timezone/174593/4 "2019-04-29T16:52:36Z")

</div>

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