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?
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
:
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');
},
});
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?
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.