diff options
Diffstat (limited to 'model/utils.go')
-rw-r--r-- | model/utils.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/model/utils.go b/model/utils.go index 172b78242..849e529c1 100644 --- a/model/utils.go +++ b/model/utils.go @@ -564,3 +564,26 @@ func IsDomainName(s string) bool { return ok } + +func RemoveDuplicateStrings(in []string) []string { + out := []string{} + seen := make(map[string]bool, len(in)) + + for _, item := range in { + if !seen[item] { + out = append(out, item) + + seen[item] = true + } + } + + return out +} + +func GetPreferredTimezone(timezone StringMap) string { + if timezone["useAutomaticTimezone"] == "true" { + return timezone["automaticTimezone"] + } + + return timezone["manualTimezone"] +} |