Skip to content

Commit

Permalink
Add a NewCustomLocalTimeZone
Browse files Browse the repository at this point in the history
  • Loading branch information
albertyw committed Feb 25, 2023
1 parent f62ec99 commit ef4d353
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions localtimezone.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit ef4d353

Please sign in to comment.