Add week urls to calendar
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
4c2834f57c
commit
a4a9a5ca7a
8
main.go
8
main.go
|
@ -400,11 +400,11 @@ func prepareDays(t time.Time) []Day {
|
||||||
endOfMonth := false
|
endOfMonth := false
|
||||||
|
|
||||||
for i := 0; i < 6; i++ {
|
for i := 0; i < 6; i++ {
|
||||||
_, week := curDate.ISOWeek()
|
year, week := curDate.ISOWeek()
|
||||||
days = append(days, Day{
|
days = append(days, Day{
|
||||||
Class: "week day",
|
Class: "week day",
|
||||||
Text: fmt.Sprintf("%02d", week),
|
Text: fmt.Sprintf("%02d", week),
|
||||||
URL: "",
|
URL: fmt.Sprintf("/edit/%s", formatWeekPageName(year, week)),
|
||||||
Count: "",
|
Count: "",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -447,6 +447,10 @@ func prepareDays(t time.Time) []Day {
|
||||||
return days
|
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 {
|
func timeEqual(date time.Time, today time.Time) bool {
|
||||||
if date.Year() != today.Year() {
|
if date.Year() != today.Year() {
|
||||||
return false
|
return false
|
||||||
|
|
Loading…
Reference in New Issue
Block a user