Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FetchLocation ¶
fetchLocation makes an API request to https://ipapi.co and returns location data.
func GetLocalTZ ¶
GetLocalTZ tries to load a time.Location by name, or returns the system's local time zone. If both fail, returns an error.
Types ¶
type LocationData ¶
type LocationData struct {
IP string `json:"ip"`
Country string `json:"country_name"`
CountryCode string `json:"country_code"`
Region string `json:"region"`
City string `json:"city"`
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
TimeZone string `json:"timezone"`
Org string `json:"org"`
ASN string `json:"asn"`
}
type TimeConversionResult ¶
type TimeConversionResult struct {
Source TimeResult `json:"source_timezone"`
Target TimeResult `json:"target_timezone"`
TimeDifference string `json:"time_difference"`
}
func ConvertTime ¶
func ConvertTime(sourceTz, timeStr, targetTz string) (TimeConversionResult, error)
func (TimeConversionResult) String ¶
func (t TimeConversionResult) String() string
type TimeResult ¶
type TimeResult struct {
Timezone string `json:"timezone"`
Datetime string `json:"datetime"`
IsDST bool `json:"is_dst"`
}
func GetCurrentTime ¶
func GetCurrentTime(timezoneName string) (*TimeResult, error)
func (TimeResult) String ¶
func (t TimeResult) String() string
Click to show internal directories.
Click to hide internal directories.