timezone

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2023 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(name string) (*time.Location, error)

Load loads a timezone from the known timezone list and IANA database. Returns error if the `name` is not found.

func MustLoad

func MustLoad(name string) *time.Location

MustLoad is like `Load`, except it will return `nil` if no timezone found.

func WordIsTz

func WordIsTz(word string) bool

WordIsTz check if the specified word is a timezone code.

Types

type Info

type Info struct {
	RegexPatterns       []string
	AlternativePatterns map[*regexp.Regexp]string
	Timezones           map[string]int
}

Info is the data for parsing timezone from a string.

type OffsetData

type OffsetData struct {
	Name   string
	Regex  *regexp.Regexp
	Offset int
}

func PopTzOffset

func PopTzOffset(str string) (string, OffsetData)

PopTzOffset extracts timezone data from str then return the str with the timezone code removed.

func (OffsetData) IsZero

func (tod OffsetData) IsZero() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL