cal

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Months = map[time.Month]int{time.January: 31, time.February: 29,
	time.March: 31, time.April: 30, time.May: 31, time.June: 30, time.July: 31,
	time.August: 31, time.September: 30, time.October: 31, time.November: 30,
	time.December: 31}

Functions

func Everyday

func Everyday(t time.Time) time.Time

func FirstWeekdayInMonth

func FirstWeekdayInMonth(y int, m time.Month) time.Weekday

func MonthlyByWeekdayCount

func MonthlyByWeekdayCount(t time.Time) time.Time

func WeekdayOccurenceNumber

func WeekdayOccurenceNumber(t time.Time) int

func Weekly

func Weekly(t time.Time) time.Time

Types

type Event

type Event struct {
	Name      string        `json:"name"`
	Next      NextFunc      `json:"next"`
	Color     string        `json:"color"`
	FirstDate EventTime     `json:"first"`
	Duration  EventDuration `json:"duration"`
	LastDate  EventTime     `json:"last"`
	Cancelled []EventTime   `json:"cancelled"`
}

TODO(Amr Ojjeh): Add "Added" for exceptional events within the series

func NewEvent

func NewEvent(name, color string, first time.Time, duration time.Duration,
	last time.Time, next NextFunc) Event

func (Event) Cancel

func (e Event) Cancel(year int, month time.Month, day int)

func (Event) IsOn

func (e Event) IsOn(year int, month time.Month, day int) bool

func (Event) NormalHour

func (e Event) NormalHour() int

func (Event) NormalMinute

func (e Event) NormalMinute() int

type EventDuration

type EventDuration time.Duration

func (*EventDuration) UnmarshalJSON

func (ed *EventDuration) UnmarshalJSON(data []byte) error

type EventTime

type EventTime time.Time

func NewEventDate

func NewEventDate(year int, month time.Month, day, hour, min int) EventTime

func NewEventDateFromTime

func NewEventDateFromTime(t time.Time) EventTime

func (*EventTime) UnmarshalJSON

func (et *EventTime) UnmarshalJSON(data []byte) error

type NextFunc

type NextFunc func(time.Time) time.Time

func (*NextFunc) UnmarshalJSON

func (n *NextFunc) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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