Documentation
¶
Overview ¶
Package calendar is every calendar rule the board, standup and stats share, on years: working days, the week starting Monday, how a --since or a window is read, and the two default-window fallbacks.
Index ¶
- Constants
- func FallbackFrom(now time.Time) time.Time
- func LastActiveWorkday(now time.Time, w Workdays, activity []time.Time) time.Time
- func LastWeekStart(now time.Time) time.Time
- func LastWorkday(now time.Time, w Workdays) time.Time
- func OffsetDays(value string) (int, error)
- func Parse(arg string, now time.Time, forms Forms, workdays func() (Workdays, error)) (years.Period, error)
- type Forms
- type Workdays
Constants ¶
const FallbackDays = 14
FallbackDays is how far back LastActiveWorkday looks for activity.
Variables ¶
This section is empty.
Functions ¶
func FallbackFrom ¶
FallbackFrom is the start of the window LastActiveWorkday looks through.
func LastActiveWorkday ¶
LastActiveWorkday is local midnight of the latest working day before today with activity; with none in the window, LastWorkday, so a first run never reaches back weeks.
func LastWeekStart ¶
LastWeekStart is last week's Monday at local midnight.
func LastWorkday ¶
LastWorkday is local midnight of the working day before today's.
func OffsetDays ¶
OffsetDays reads a count of days or weeks (10d, 3w) as days. Both stats --since and stale_after read this one grammar.
func Parse ¶
func Parse(arg string, now time.Time, forms Forms, workdays func() (Workdays, error)) (years.Period, error)
Parse reads arg as the forms allow, at now. Working days are read only when arg names last-workday, so a broken config fails no other run. The error is bare: each command names its flag and its forms.