docs(discovery/crawler): clarify unused year param in parseDateAttr

This commit is contained in:
2026-04-18 12:48:38 +02:00
parent 93efb90967
commit a55bb7e15b

View File

@@ -120,10 +120,13 @@ func parseFestivalAlarm(data []byte, sourceURL string, year int) ([]RawEvent, er
return events, nil
}
// parseDateAttr reads the content="YYYY-MM-DD" attribute from a span and
// returns a *time.Time in UTC. Falls back to year for the year component if
// the attribute is absent or malformed (shouldn't happen in practice).
// parseDateAttr reads the content="YYYY-MM-DD" attribute from an itemprop
// span and returns a *time.Time in UTC. Returns nil if absent or malformed.
// The year parameter is accepted for signature symmetry with future sources
// that may not include full dates in their markup; it is intentionally unused
// here because festival-alarm always emits complete ISO dates.
func parseDateAttr(s *goquery.Selection, year int) *time.Time {
_ = year
content, exists := s.Attr("content")
if !exists || content == "" {
return nil
@@ -132,7 +135,5 @@ func parseDateAttr(s *goquery.Selection, year int) *time.Time {
if err != nil {
return nil
}
// The site always includes the correct year in the attribute; just validate.
_ = year
return &t
}