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

View File

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