Skip to content

Commit

Permalink
fix(event): set correct year
Browse files Browse the repository at this point in the history
  • Loading branch information
Topvennie committed Feb 12, 2025
1 parent 20a4a82 commit 71d53c2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion internal/pkg/event/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ func (e *Event) getEvents() ([]dto.Event, error) {
if len(yearParts) == 5 {
rangeParts := strings.Split(yearParts[2], "-")
if len(rangeParts) == 2 {
dateWithYear := fmt.Sprintf("%s 20%s", date, rangeParts[0])
partIdx := 0
if time.Now().Month() < time.September {
partIdx = 1
}

dateWithYear := fmt.Sprintf("%s 20%s", date, rangeParts[partIdx])
parsedDate, err := time.Parse(layout, dateWithYear)
if err == nil {
event.AcademicYear = yearParts[2]
Expand Down

0 comments on commit 71d53c2

Please sign in to comment.