set instance_timezone before

This commit is contained in:
lesion 2022-08-05 18:08:03 +02:00
parent 3c59e8cc66
commit e0342b0dd7
No known key found for this signature in database
GPG key ID: 352918250B012177
2 changed files with 3 additions and 1 deletions

View file

@ -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()
},

View file

@ -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)
}