setting: Fix tests on Mac (#28886)

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
Arve Knudsen
2020-11-09 14:39:56 +01:00
committed by GitHub
parent 2ddda8f452
commit ef2de2d357
2 changed files with 13 additions and 15 deletions
+7 -8
View File
@@ -22,18 +22,17 @@ type DateFormatIntervals struct {
Year string `json:"year"`
}
const LocalBrowserTimezone = "browser"
const localBrowserTimezone = "browser"
func valueAsTimezone(section *ini.Section, keyName string, defaultValue string) (string, error) {
timezone := section.Key(keyName).MustString(defaultValue)
if timezone == LocalBrowserTimezone {
return LocalBrowserTimezone, nil
func valueAsTimezone(section *ini.Section, keyName string) (string, error) {
timezone := section.Key(keyName).MustString(localBrowserTimezone)
if timezone == localBrowserTimezone {
return localBrowserTimezone, nil
}
location, err := time.LoadLocation(timezone)
if err != nil {
return LocalBrowserTimezone, err
return localBrowserTimezone, err
}
return location.String(), nil
@@ -50,7 +49,7 @@ func (cfg *Cfg) readDateFormats() {
cfg.DateFormats.Interval.Year = "YYYY"
cfg.DateFormats.UseBrowserLocale = dateFormats.Key("date_format_use_browser_locale").MustBool(false)
timezone, err := valueAsTimezone(dateFormats, "default_timezone", LocalBrowserTimezone)
timezone, err := valueAsTimezone(dateFormats, "default_timezone")
if err != nil {
cfg.Logger.Warn("Unknown timezone as default_timezone", "err", err)
}