- Calendar template fixed

- Bug with ics events, from another years fixed
This commit is contained in:
develoopeer 2024-11-14 09:06:47 +03:00
parent 2eb1821941
commit 4cb8b0f4f4
2 changed files with 14 additions and 12 deletions

View File

@ -1,6 +1,6 @@
{{ template "widget-base.html" . }} {{ template "widget-base.html" . }}
{{ define "widget-content" }} {{ define "widget-content" }} {{ define "widget-content" }}
<div class="widget-small-content-bounds"> <div class="widget-small-content-bounds">
<div class="flex justify-between items-center"> <div class="flex justify-between items-center">
<div class="color-highlight size-h1">{{ .Calendar.CurrentMonthName }}</div> <div class="color-highlight size-h1">{{ .Calendar.CurrentMonthName }}</div>
@ -20,15 +20,17 @@
<div class="calendar-day">Su</div> <div class="calendar-day">Su</div>
</div> </div>
<div class="flex flex-wrap justify-center items-center"> <div class="flex flex-wrap justify-center items-center">
{{ range .Calendar.Days }} {{ range .Calendar.Days }}
<div class="calendar-day{{ if eq .Day $.Calendar.CurrentDay }} calendar-day-today{{ end }} {{ if .IsEvent}} calendar-isevent{{ end }}"> <div class="calendar-day{{ if eq .Day $.Calendar.CurrentDay }} calendar-day-today{{ end }} {{ if .IsEvent}} calendar-isevent{{ end }}">
{{ if .IsEvent}} {{ if .IsEvent}}
<div class="tooltip"> <div class="tooltip">
<span class="tooltiptext">{{ .Event.EventHover }}</span> <span class="tooltiptext">{{ .Event.EventHover }}</span>
</div> </div>
{{ end }} {{ end }}
<span>{{ .Day }}</span> <span>{{ .Day }}</span>
</div> </div>
{{ end }}
</div>
</div> </div>
{{ end }} {{ end }}

View File

@ -53,7 +53,7 @@ func NewCalendar(now time.Time, icsurl string) *Calendar {
if err != nil { if err != nil {
log.Panic(err) log.Panic(err)
} }
if startAt.Day() == day && startAt.Month() == month { if startAt.Day() == day && startAt.Month() == month && startAt.Year() == year {
dayEvent.StartedDay = startAt dayEvent.StartedDay = startAt
dayEvent.EventHover = event.GetProperty("SUMMARY").Value dayEvent.EventHover = event.GetProperty("SUMMARY").Value
days[i].IsEvent = true days[i].IsEvent = true