calendar

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 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 calendar owns the M4 "calendar" plugin. It collapses the per-day contribution data already populated by base.runIndepth (Computed.ContributionCalendar) into a per-year × per-month histogram.

Index

Constants

View Source
const Name = "calendar"

Name is the canonical plugin slug.

Variables

View Source
var Plugin plugins.Plugin = &calendarPlugin{}

Plugin is the singleton registered with the global plugin registry.

Functions

func Partial

Partial renders the classic SVG fragment for the calendar plugin. Multi-year heatmap matching upstream org_repo/source/templates/classic/partials/calendar.ejs.

Settings: mjun0812 uses plugin_calendar: yes, plugin_calendar_limit: 3.

func SetNowForTest added in v1.2.0

func SetNowForTest(fn func() time.Time) func()

SetNowForTest overrides the calendar clock and returns a restore function.

Types

type CalendarWeek added in v1.1.0

type CalendarWeek struct {
	ContributionDays []ContributionCell `json:"contributionDays"`
}

CalendarWeek mirrors upstream `week.contributionDays`. May have 1-7 entries; a year-boundary week is short (1-6 days) and the partial offsets it so the cells align with the right weekday rows.

type ContributionCell added in v1.1.0

type ContributionCell struct {
	Date  string `json:"date"`
	Color string `json:"color"`
	Count int    `json:"count"`
}

ContributionCell mirrors one cell in the heatmap — `{date, color}` per upstream EJS line 21. Count is included as additional metadata (upstream's GraphQL exposes it; the EJS doesn't render it, but downstream consumers may use it).

type Result

type Result struct {
	Skipped       bool           `json:"skipped,omitempty"`
	SkippedReason string         `json:"-"`
	Years         []YearCalendar `json:"years"`
	Limit         int            `json:"limit"`
}

Result is the JSON payload published under data.Plugins["calendar"].

func (*Result) IsSkipped

func (r *Result) IsSkipped() bool

IsSkipped lets the classic dispatcher detect the skipped path.

type YearCalendar

type YearCalendar struct {
	Year   int            `json:"year"`
	Total  int            `json:"total"`
	Months [12]int        `json:"months"`
	Weeks  []CalendarWeek `json:"weeks"`
}

YearCalendar carries one calendar year's contribution histogram + per-week per-day cells for the upstream-equivalent heatmap render. Months[12] is preserved for backward compat with the v1 JSON shape (Principle II additive extension).

Jump to

Keyboard shortcuts

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