From ef4d3539b4549f7fc52d8cbff9dd287714b1fb82 Mon Sep 17 00:00:00 2001 From: Albert Wang Date: Sat, 25 Feb 2023 12:04:31 -0800 Subject: [PATCH] Add a NewCustomLocalTimeZone --- localtimezone.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/localtimezone.go b/localtimezone.go index 0e2dbdf..0a37c8f 100644 --- a/localtimezone.go +++ b/localtimezone.go @@ -120,6 +120,15 @@ func NewMockLocalTimeZone() LocalTimeZone { return &z } +// NewCustomLocalTimeZone creates a new LocalTimeZone but based on custom +// passed-in json data +// The client is threadsafe +func NewCustomLocalTimeZone(data io.Reader) (LocalTimeZone, error) { + z := localTimeZone{} + err := z.LoadGeoJSON(data) + return &z, err +} + func (z *localTimeZone) load(shapeFile []byte) error { g, err := gzip.NewReader(bytes.NewBuffer(shapeFile)) if err != nil {