Treat today differently in previous day view
This commit is contained in:
parent
6e1095019f
commit
1ba9c87184
1 changed files with 7 additions and 0 deletions
|
@ -89,6 +89,9 @@ func GetDays(w http.ResponseWriter, r *http.Request) {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
dayString = t.Format("02 Jan 2006")
|
dayString = t.Format("02 Jan 2006")
|
||||||
}
|
}
|
||||||
|
if v == time.Now().Format(time.DateOnly) {
|
||||||
|
dayString = "Today"
|
||||||
|
}
|
||||||
daysFormatted = append(daysFormatted, ListEntry{Name: dayString, Link: v})
|
daysFormatted = append(daysFormatted, ListEntry{Name: dayString, Link: v})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,6 +119,10 @@ func GetDay(w http.ResponseWriter, r *http.Request) {
|
||||||
HandleWrite(w.Write([]byte("day not specified")))
|
HandleWrite(w.Write([]byte("day not specified")))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if dayString == time.Now().Format(time.DateOnly) { // today can still be edited
|
||||||
|
http.Redirect(w, r, "/", 302)
|
||||||
|
return
|
||||||
|
}
|
||||||
day, err := ReadFile("day/" + dayString)
|
day, err := ReadFile("day/" + dayString)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
slog.Error("error reading day's file", "error", err, "day", dayString)
|
slog.Error("error reading day's file", "error", err, "day", dayString)
|
||||||
|
|
Loading…
Reference in a new issue