Compare commits
No commits in common. "a4a9a5ca7a0ebcb80137a76c6ade117c3fb842c4" and "27200abc582dea2ff9a58a6f35f5fb4b302e8e9a" have entirely different histories.
a4a9a5ca7a
...
27200abc58
17
main.go
17
main.go
|
|
@ -388,23 +388,18 @@ func prepareDays(t time.Time) []Day {
|
||||||
|
|
||||||
var days []Day
|
var days []Day
|
||||||
|
|
||||||
curDate := t.AddDate(0, 0, -(t.Day()-1))
|
curDate := t.AddDate(0, 0, -t.Day()+1)
|
||||||
preDays := int(curDate.Weekday())
|
preDays := int(curDate.Weekday()) - 1
|
||||||
if preDays == 0 {
|
|
||||||
preDays = 7
|
|
||||||
}
|
|
||||||
preDays -= 1
|
|
||||||
|
|
||||||
maxDays := daysInMonth(curDate.Year(), curDate.Month())
|
maxDays := daysInMonth(curDate.Year(), curDate.Month())
|
||||||
|
|
||||||
endOfMonth := false
|
endOfMonth := false
|
||||||
|
|
||||||
for i := 0; i < 6; i++ {
|
for i := 0; i < 6; i++ {
|
||||||
year, week := curDate.ISOWeek()
|
_, 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: fmt.Sprintf("/edit/%s", formatWeekPageName(year, week)),
|
URL: "",
|
||||||
Count: "",
|
Count: "",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -447,10 +442,6 @@ 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