Documentation
¶
Overview ¶
Package timezone loads a time zone by the name HEY will look it up by.
HEY stores a zone name it cannot find rather than refusing it, reads the event as UTC, and fails later in its own edit form, so every name this program sends as an event's zone — `hey event --time-zone`, the account's zone, the zone chosen on the TUI's event form — is checked here first, by the same rules.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotAZone = errors.New("not an IANA zone name")
ErrNotAZone is a name time.LoadLocation answers that HEY cannot look up.
Functions ¶
func FirstClockFrom ¶
FirstClockFrom is the earliest clock time in loc, in whole minutes, that HEY places no earlier than at and places where it reads — the instant it places it at. Clock times are searched rather than instants, a minute at a time: an instant between whole minutes, as the start of anything in a zone that kept seconds in its offset is, cannot be sent at all, and neither can a time the clocks skip (HEY moves it on an hour) or the second of two they repeat (HEY takes the first).
func Load ¶
Load loads a zone the way HEY will look it up: by its exact IANA name.
Go answers a few names HEY has no zone for: Local, the zone files that are not zones, and a path the file system tidies up, like America//New_York. And on a case-insensitive disk, as macOS has, it loads america/new_york from the file America/New_York, where HEY's lookup is case-sensitive; zoneFileSpelledAs catches that.
func Placed ¶
Placed is the instant HEY stores for a date and a clock time sent with a zone: placed in that zone by WallClock, or read as UTC when no zone is sent, since HEY answers a JSON request in UTC. It answers false for a date or a time that does not parse.
func WallClock ¶
WallClock is a clock time on a day, resolved the way HEY resolves one. A clock time that does not exist — the hour a zone springs forward over, or the whole of 30 December 2011 in Samoa — is moved an hour later and tried again, date and all, until it does: that is what ActiveSupport does with a local time TZInfo cannot find. A clock time that happens twice is resolved by heysChoice. Go's time.Date is no guide to either: it picks one side of a gap or an overlap by its own rules, not HEY's, so a title-only edit would move the day.
Only day's date and wall's clock are read; their zones are not.
Types ¶
This section is empty.