diff --git a/server/helpers.js b/server/helpers.js index d1ed32ee..86e42adb 100644 --- a/server/helpers.js +++ b/server/helpers.js @@ -3,6 +3,8 @@ const settingsController = require('./api/controller/settings') const acceptLanguage = require('accept-language') const express = require('express') const dayjs = require('dayjs') +const timezone = require('dayjs/plugin/timezone') +dayjs.extend(timezone) const config = require('./config') const log = require('./log') @@ -81,6 +83,7 @@ module.exports = { res.locals.settings.version = pkg.version // set user locale res.locals.user_locale = settingsController.user_locale[res.locals.acceptedLocale] + dayjs.tz.setDefault(res.locals.settings.instance_timezone) next() }, diff --git a/store/index.js b/store/index.js index 79ab7214..c8b75b4d 100644 --- a/store/index.js +++ b/store/index.js @@ -41,7 +41,6 @@ export const actions = { // we use it to get configuration from db, set locale, etc... nuxtServerInit ({ commit }, { _req, res }) { commit('setSettings', res.locals.settings) - dayjs.tz(res.locals.settings.instance_timezone) if (res.locals.status === 'READY') { commit('setAnnouncements', res.locals.announcements) }