timezone

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
var ErrNotAZone = errors.New("not an IANA zone name")

ErrNotAZone is a name time.LoadLocation answers that HEY cannot look up.

Functions

func FirstClockFrom

func FirstClockFrom(at time.Time, loc *time.Location) time.Time

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

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

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 MovedBy

func MovedBy(had, sent time.Time) string

MovedBy says how far and which way an instant would move, from had to sent.

func Placed

func Placed(date, clock string, loc *time.Location) (time.Time, bool)

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

func WallClock(day, wall time.Time, loc *time.Location) time.Time

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.

Jump to

Keyboard shortcuts

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