Skip to content

Commit

Permalink
augment with holiday info
Browse files Browse the repository at this point in the history
  • Loading branch information
kaihendry committed Mar 11, 2024
1 parent e3a4017 commit 6e6e0af
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
6 changes: 4 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ module github.com/kaihendry/days

go 1.22

require github.com/apex/gateway/v2 v2.0.0
require (
github.com/apex/gateway/v2 v2.0.0
github.com/arran4/golang-ical v0.2.7
)

require (
github.com/arran4/golang-ical v0.2.7 // indirect
github.com/aws/aws-lambda-go v1.46.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
)
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ github.com/apex/gateway/v2 v2.0.0/go.mod h1:y+uuK0JxdvTHZeVns501/7qklBhnDHtGU0hf
github.com/arran4/golang-ical v0.2.7 h1:VO7YlVaGupZE15aj6NhUhte/MIfZuoIzkoI71VsG6Gg=
github.com/arran4/golang-ical v0.2.7/go.mod h1:RqMuPGmwRRwjkb07hmm+JBqcWa1vF1LvVmPtSZN2OhQ=
github.com/aws/aws-lambda-go v1.17.0/go.mod h1:FEwgPLE6+8wcGBTe5cJN3JWurd1Ztm9zN4jsXsjzKKw=
github.com/aws/aws-lambda-go v1.41.0 h1:l/5fyVb6Ud9uYd411xdHZzSf2n86TakxzpvIoz7l+3Y=
github.com/aws/aws-lambda-go v1.41.0/go.mod h1:jwFe2KmMsHmffA1X2R09hH6lFzJQxzI8qK17ewzbQMM=
github.com/aws/aws-lambda-go v1.46.0 h1:UWVnvh2h2gecOlFhHQfIPQcD8pL/f7pVCutmFl+oXU8=
github.com/aws/aws-lambda-go v1.46.0/go.mod h1:dpMpZgvWx5vuQJfBt0zqBha60q7Dd7RfgJv23DymV8A=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
Expand Down
6 changes: 4 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ import (
var tmpl embed.FS

type day struct {
Date time.Time
IsHoliday bool
Date time.Time
IsHoliday bool
HolidaySummary string
}

func days(month time.Time) (days []day) {
Expand Down Expand Up @@ -100,6 +101,7 @@ func main() {
}
if d.Date.After(start) && d.Date.Before(end) {
days[i].IsHoliday = true
days[i].HolidaySummary = h.GetProperty(ics.ComponentPropertySummary).Value
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,10 @@ <h2>Week Number: {{ $currentWeek }}</h2> <!-- Print the week number if it's diff

<p>
{{- $day.Date.Format "2006-01-02 Mon" }}
{{ if $day.IsHoliday }}<span> (Holiday)</span>{{ end }}
{{ if $day.IsHoliday }}<span> ({{ $day.HolidaySummary }})</span>{{ end }}
</p>

{{ end }}

{{end}}
</main>

Expand Down

0 comments on commit 6e6e0af

Please sign in to comment.