calendar

package
v0.20.2 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: Apache-2.0 Imports: 2 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 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