summaryrefslogtreecommitdiffstats
path: root/app/timezone.go
diff options
context:
space:
mode:
Diffstat (limited to 'app/timezone.go')
-rw-r--r--app/timezone.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/app/timezone.go b/app/timezone.go
new file mode 100644
index 000000000..84d912da6
--- /dev/null
+++ b/app/timezone.go
@@ -0,0 +1,28 @@
+// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+package app
+
+import (
+ "github.com/mattermost/mattermost-server/model"
+ "github.com/mattermost/mattermost-server/utils"
+)
+
+func (a *App) Timezones() model.SupportedTimezones {
+ if cfg := a.timezones.Load(); cfg != nil {
+ return cfg.(model.SupportedTimezones)
+ }
+ return model.SupportedTimezones{}
+}
+
+func (a *App) LoadTimezones() {
+ timezonePath := "timezones.json"
+
+ if a.Config().TimezoneSettings.SupportedTimezonesPath != nil && len(*a.Config().TimezoneSettings.SupportedTimezonesPath) > 0 {
+ timezonePath = *a.Config().TimezoneSettings.SupportedTimezonesPath
+ }
+
+ timezoneCfg := utils.LoadTimezones(timezonePath)
+
+ a.timezones.Store(timezoneCfg)
+}