aboutsummaryrefslogtreecommitdiffhomepage
path: root/storage
diff options
context:
space:
mode:
authorGravatar Frédéric Guillot <fred@miniflux.net>2018-03-04 17:38:08 -0800
committerGravatar Frédéric Guillot <fred@miniflux.net>2018-03-04 17:38:08 -0800
commita8be61cdbb09a895f48884a1567a8e6aa2694381 (patch)
treedd46baafaaf202100ff1de5eccf4986c7c87b363 /storage
parent609c57332e73aa753d9c198cad3595cde501c1ff (diff)
Filter the list of timezones
Diffstat (limited to 'storage')
-rw-r--r--storage/timezone.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/storage/timezone.go b/storage/timezone.go
index 949a6af..396c7d4 100644
--- a/storage/timezone.go
+++ b/storage/timezone.go
@@ -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