Skip to content
Snippets Groups Projects
Commit a8be61cd authored by Frédéric Guillot's avatar Frédéric Guillot
Browse files

Filter the list of timezones

parent 609c5733
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,7 @@ package storage
import (
"fmt"
"strings"
"time"
"github.com/miniflux/miniflux/timer"
......@@ -14,10 +15,8 @@ import (
// Timezones returns all timezones supported by the database.
func (s *Storage) Timezones() (map[string]string, error) {
defer timer.ExecutionTime(time.Now(), "[Storage:Timezones]")
timezones := make(map[string]string)
query := `select name from pg_timezone_names() order by name asc`
rows, err := s.db.Query(query)
rows, err := s.db.Query(`SELECT name FROM pg_timezone_names() ORDER BY name ASC`)
if err != nil {
return nil, fmt.Errorf("unable to fetch timezones: %v", err)
}
......@@ -29,7 +28,9 @@ func (s *Storage) Timezones() (map[string]string, error) {
return nil, fmt.Errorf("unable to fetch timezones row: %v", err)
}
timezones[timezone] = timezone
if !strings.HasPrefix(timezone, "posix") && !strings.HasPrefix(timezone, "SystemV") && timezone != "localtime" {
timezones[timezone] = timezone
}
}
return timezones, nil
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment