kitchencalendar

package module
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: BSD-3-Clause Imports: 13 Imported by: 0

README

Kitchen Calendar

Build Go Report Card License

Kitchen Calendar is a utility written in Go that can generate PDF files.

Each generated PDF document is a calendar for two specific weeks, for example week 7 and 8.

This type of calendar can work great for a family of 4, a couple of co-workers or people that live together and need to find a good way to collaborate.

By printing out and hanging up the calendars on the kitchen cupboard doors, there are no excuses for not having a good overview of what is happening in the weeks ahead, nor for what has been done or completed.

I recommend printing out at least 6 pages, which covers 12 weeks, and hang them all up. It does occupy quite a bit of "visual space" in the kitchen, but it's immensely handy and practical.

The reason why I wrote this utility is because we use it in my family, and it works better for us than Google Calendar or other apps or web pages. The information is readily available without anyone having to "do anything" to see it, and one can easily add entries while making tea or coffee.

In addition to this, "red dates" (holidays / flag flying dates) are written in bold text in the calendar. The functionality for detecting "red days" comes from the kal package (this feature needs more testing).

Currently, only US and Norwegian calendars can be generated, but pull requests for supporting other locales are welcome!

The line art images comes from the excellent ln package.

Example calendar (English, for the US)

US kitchen calendar

Note that the 4th of July is in bold.

Example calendar (Norwegian)

Norwegian kitchen calendar

Note that the 17th of May is in bold.

Installation

Go 1.17 or later is needed for go install to work as expected.

Install the US kitchen calendar generator:

go install -tags en_US github.com/xyproto/kitchencalendar@latest

Install the Norwegian kitchen calendar generator:

go install -tags nb_NO github.com/xyproto/kitchencalendar@latest
Usage

The utility takes a list of comma separated names that will be used in the weekly overviews.

For creating a calendar_w8_2023.pdf file:

kitchencalendar -names Bob,Alice,Mallory,Judy -year 2023 -week 8

For generating calendars for week 7 to 17 (with 2 weeks on each PDF), for this year

for x in $(seq 7 2 17); do kitchencalendar -names Bob,Alice,Mallory,Judy -week $x; done
General info
  • Version: 1.0.5
  • License: BSD-3
  • Author: Alexander F. Rødseth

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DayAndDate

func DayAndDate(cal kal.Calendar, t time.Time) string

func DrawLineImage

func DrawLineImage(pdf *gopdf.GoPdf, year, week int, x, y, width, height float64) error

DrawLineImage draws an image into the PDF, using only lines

func FirstMondayOfWeek

func FirstMondayOfWeek(year, week int) time.Time

FirstMondayOfWeek finds the first monday of the week, given a year and a week number

func FirstSaturdayAfter

func FirstSaturdayAfter(date time.Time) time.Time

FirstSaturdayAfter takes a time.Time and returns the first Saturday after the given date as a time.Time

func FirstSundayAfter

func FirstSundayAfter(date time.Time) time.Time

FirstSundayAfter finds the first Sunday after the given date

func FirstSundayOfWeek

func FirstSundayOfWeek(year, week int) time.Time

FirstSundayOfWeek finds the first monday of the week, given a year and a week number

func FormatDate

func FormatDate(cal kal.Calendar, date time.Time) string

func GeneratePDF

func GeneratePDF(year, week int, names []string, drawing bool) ([]byte, error)

func GetCurrentWeek

func GetCurrentWeek() int

GetCurrentWeek returns the current week number as an int

func GetCurrentYear

func GetCurrentYear() int

GetCurrentYear returns the current year as an int

func GetMonthAbbrev

func GetMonthAbbrev(cal kal.Calendar, month time.Month) string

GetMonthAbbrev takes a time.Month and returns the abbreviation in the current locale

func GetMonthName

func GetMonthName(cal kal.Calendar, t time.Time) string

GetMonthName takes a time.Time and returns the name of the month in the current locale

func IterateDays

func IterateDays(startDay, endDay time.Time, f func(time.Time) error) error

IterateDays iterates over days from startDay to endDay (inclusive) and calls f for each day

func MonthNumber

func MonthNumber(year, week int) int

MonthNumber returns the month number given a year int and a week int.

func NewCalendar

func NewCalendar() (kal.Calendar, error)

func WeekString

func WeekString(week int) string

Types

This section is empty.

Directories

Path Synopsis
cmd
kitchencalendar command

Jump to

Keyboard shortcuts

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