mirror of
https://github.com/grafana/grafana.git
synced 2024-12-02 13:39:19 -06:00
5c31f07904
* Settings: Remove unnecessary error handling code Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
29 lines
1.2 KiB
Go
29 lines
1.2 KiB
Go
package setting
|
|
|
|
type DateFormats struct {
|
|
FullDate string `json:"fullDate"`
|
|
UseBrowserLocale bool `json:"useBrowserLocale"`
|
|
Interval DateFormatIntervals `json:"interval"`
|
|
}
|
|
|
|
type DateFormatIntervals struct {
|
|
Second string `json:"second"`
|
|
Minute string `json:"minute"`
|
|
Hour string `json:"hour"`
|
|
Day string `json:"day"`
|
|
Month string `json:"month"`
|
|
Year string `json:"year"`
|
|
}
|
|
|
|
func (cfg *Cfg) readDateFormats() {
|
|
dateFormats := cfg.Raw.Section("date_formats")
|
|
cfg.DateFormats.FullDate = valueAsString(dateFormats, "full_date", "YYYY-MM-DD HH:mm:ss")
|
|
cfg.DateFormats.Interval.Second = valueAsString(dateFormats, "interval_second", "HH:mm:ss")
|
|
cfg.DateFormats.Interval.Minute = valueAsString(dateFormats, "interval_minute", "HH:mm")
|
|
cfg.DateFormats.Interval.Hour = valueAsString(dateFormats, "interval_hour", "MM-DD HH:mm")
|
|
cfg.DateFormats.Interval.Day = valueAsString(dateFormats, "interval_day", "YYYY-MM-DD")
|
|
cfg.DateFormats.Interval.Month = valueAsString(dateFormats, "interval_month", "YYYY-MM")
|
|
cfg.DateFormats.Interval.Year = "YYYY"
|
|
cfg.DateFormats.UseBrowserLocale = dateFormats.Key("date_format_use_browser_locale").MustBool(false)
|
|
}
|