Documentation
¶
Overview ¶
Package zone provides internal IANA timezone data and DST projection utilities.
Index ¶
Constants ¶
View Source
const CatalogVersion = "2025b"
CatalogVersion is the IANA tzdb version used to generate Zones.
Variables ¶
View Source
var WindowsToIANA = map[string]string{}/* 139 elements not displayed */
WindowsToIANA maps Windows timezone names to CLDR's territory 001 IANA defaults.
View Source
var Zones = []string{}/* 419 elements not displayed */
Zones is a sorted list of IANA timezone identifiers embedded at build time. Callers must not mutate this slice.
Functions ¶
Types ¶
type DSTStatus ¶
type DSTStatus int
DSTStatus describes the DST classification of a projected local time.
const ( // DSTNormal means the local time maps to exactly one UTC instant. DSTNormal DSTStatus = iota // DSTNonexistent means the local time falls in a spring-forward gap (no such wall time exists). DSTNonexistent // DSTAmbiguous means the local time falls in a fall-back overlap (two UTC instants map to it). DSTAmbiguous )
type LocalTimeResult ¶
type LocalTimeResult struct {
// Status classifies the local time as normal, nonexistent, or ambiguous.
Status DSTStatus
// Times holds the matching instants in chronological order.
Times []time.Time
}
LocalTimeResult holds the outcome of projecting a local wall-clock time into a timezone.
func ProjectLocalTime ¶
func ProjectLocalTime(loc *time.Location, year int, month time.Month, day, hour, minute, second int) LocalTimeResult
ProjectLocalTime projects a local wall-clock time into loc and classifies the DST status.
Algorithm:
- Construct t = time.Date(year, month, day, hour, minute, second, 0, loc).
- Gap detection: if t's actual local components differ from requested, the wall time does not exist. Compare the date too, because some zones skip whole calendar days.
- Overlap detection: collect nearby UTC offsets and reproject the same wall time under each offset. This catches non-hour transitions such as Australia/Lord_Howe's 30-minute fall-back overlap without assuming every DST boundary is exactly one hour.
- Otherwise → DSTNormal with a single instant.
Directories
¶
| Path | Synopsis |
|---|---|
|
The geniana command generates the internal IANA timezone catalog.
|
The geniana command generates the internal IANA timezone catalog. |
|
The genwindows command generates the Windows-to-IANA mapping from a pinned Unicode CLDR windowsZones.xml release.
|
The genwindows command generates the Windows-to-IANA mapping from a pinned Unicode CLDR windowsZones.xml release. |
Click to show internal directories.
Click to hide internal directories.