From 7fb0c1e17c5b416c07f48a522435e06e0c005289 Mon Sep 17 00:00:00 2001 From: David Schneiderbauer Date: Sun, 6 Jun 2021 14:55:13 +0200 Subject: [PATCH] fix slot parsing --- api.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api.go b/api.go index ef52f7f..b52102d 100644 --- a/api.go +++ b/api.go @@ -33,12 +33,12 @@ func getCovidVaccinationSlots(authority int) ([]slot, error) { // startDate of slots doesn't follow the ISO 8601 definition so we need to parse the dates by ourselves. func parseSlots(jsonSlots []map[string]interface{}) ([]slot, error) { slots := make([]slot, len(jsonSlots)) - for _, jsonSlot := range jsonSlots { + for i, jsonSlot := range jsonSlots { startDate, err := time.ParseInLocation("2006-01-02T15:04:05", jsonSlot["startDate"].(string), time.Local) if err != nil { return nil, fmt.Errorf("parse time failed: %w", err) } - slots = append(slots, slot{startDate}) + slots[i] = slot{startDate} } return slots, nil -} \ No newline at end of file +}