setting: Fix tests on Mac (#28886)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user