Add week urls to calendar
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Peter Stuifzand 2021-08-11 19:57:25 +02:00
parent 4c2834f57c
commit a4a9a5ca7a

View File

@ -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