calendar

package
v0.19.2 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package calendar is the single owner of "which calendar day is this?".

Two stored shapes exist:

  • Instant — created_at, updated_at, resolved_at, status_changed_at, reopened_at, assignee_changed_at. UTC timestamps. The calendar day is the day in the given zone (local for the UI / Match).
  • Date — duedate. A YYYY-MM-DD calendar date stored as written. Never parse it as UTC midnight.

Go and the web (web/src/lib/calendar.ts) implement the same rules. Explain reports the decision so a mismatch is observable.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Day

func Day(raw string, kind Kind, z Zone) (string, bool)

Day returns YYYY-MM-DD for raw, or false when it cannot be read.

func FormatDay

func FormatDay(t time.Time, z Zone) string

FormatDay is YYYY-MM-DD of t in z. compileDate uses this so JQL startOfDay() / -7d land on the same calendar the matcher uses.

func InRange

func InRange(raw string, kind Kind, from, to string, z Zone) bool

InRange is an inclusive YYYY-MM-DD compare after Day. An empty raw fails when any bound is set; with no bounds it still passes.

Types

type Decision

type Decision struct {
	Raw         string `json:"raw"`
	Kind        string `json:"kind"`
	Zone        string `json:"zone"`
	CalendarDay string `json:"calendar_day"`
	OK          bool   `json:"ok"`
}

Decision is one Day conversion, for tests and debugging.

func Explain

func Explain(raw string, kind Kind, z Zone) Decision

Explain reports how Day classified raw.

type Kind

type Kind int

Kind selects how a stored value is read.

const (
	// Instant is a UTC timestamp (RFC3339 / ISO-8601).
	Instant Kind = iota
	// Date is a calendar day stored as YYYY-MM-DD.
	Date
)

func (Kind) String

func (k Kind) String() string

type Zone

type Zone struct {
	// contains filtered or unexported fields
}

Zone is the calendar used for Instant → day. Date values ignore it.

func In

func In(loc *time.Location) Zone

In wraps a location. nil falls back to Local.

func Local

func Local() Zone

Local is the process local zone (the viewer's zone in the UI / CLI).

func Named

func Named(name string) (Zone, error)

Named loads an IANA zone (tests pin Asia/Seoul so CI UTC cannot hide a miss).

func UTC

func UTC() Zone

UTC is the UTC zone.

func (Zone) Name

func (z Zone) Name() string

Name is the IANA / Local identifier Explain reports.

Jump to

Keyboard shortcuts

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