Filter the list of timezones
This commit is contained in:
parent
609c57332e
commit
a8be61cdbb
1 changed files with 5 additions and 4 deletions
|
@ -6,6 +6,7 @@ package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/miniflux/miniflux/timer"
|
"github.com/miniflux/miniflux/timer"
|
||||||
|
@ -14,10 +15,8 @@ import (
|
||||||
// Timezones returns all timezones supported by the database.
|
// Timezones returns all timezones supported by the database.
|
||||||
func (s *Storage) Timezones() (map[string]string, error) {
|
func (s *Storage) Timezones() (map[string]string, error) {
|
||||||
defer timer.ExecutionTime(time.Now(), "[Storage:Timezones]")
|
defer timer.ExecutionTime(time.Now(), "[Storage:Timezones]")
|
||||||
|
|
||||||
timezones := make(map[string]string)
|
timezones := make(map[string]string)
|
||||||
query := `select name from pg_timezone_names() order by name asc`
|
rows, err := s.db.Query(`SELECT name FROM pg_timezone_names() ORDER BY name ASC`)
|
||||||
rows, err := s.db.Query(query)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("unable to fetch timezones: %v", err)
|
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)
|
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
|
return timezones, nil
|
||||||
|
|
Loading…
Reference in a new issue