From a4a9a5ca7a0ebcb80137a76c6ade117c3fb842c4 Mon Sep 17 00:00:00 2001 From: Peter Stuifzand Date: Wed, 11 Aug 2021 19:57:25 +0200 Subject: [PATCH] Add week urls to calendar --- main.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index e4760c3..0c7292d 100644 --- a/main.go +++ b/main.go @@ -400,11 +400,11 @@ func prepareDays(t time.Time) []Day { endOfMonth := false for i := 0; i < 6; i++ { - _, week := curDate.ISOWeek() + year, week := curDate.ISOWeek() days = append(days, Day{ Class: "week day", Text: fmt.Sprintf("%02d", week), - URL: "", + URL: fmt.Sprintf("/edit/%s", formatWeekPageName(year, week)), Count: "", }) @@ -447,6 +447,10 @@ func prepareDays(t time.Time) []Day { return days } +func formatWeekPageName(year int, week int) string { + return fmt.Sprintf("%04dW%02d", year, week) +} + func timeEqual(date time.Time, today time.Time) bool { if date.Year() != today.Year() { return false