diff --git a/cmd/history.go b/cmd/history.go index ea94fef..937e7b5 100644 --- a/cmd/history.go +++ b/cmd/history.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + "strconv" pb "codeberg.org/andcscott/weather-cli/proto" ) @@ -49,14 +50,16 @@ func getUnixTime(c pb.RouteGuideClient) int32 { // Query SimplrWeather for historical data func getHistoricalData(c pb.RouteGuideClient, app *Application) { - var lat, lon, year, month, day int32 + var lat, lon int + lat, _ = strconv.Atoi(app.Config.Latitude) + lon, _ = strconv.Atoi(app.Config.Longitude) res, err := c.GetHistoricalData(context.Background(), &pb.LocationDate{ - Latitude: lat, - Longitude: lon, - Year: year, - Month: month, - Day: day, + Latitude: int32(lat), + Longitude: int32(lon), + Year: app.Config.Date.Year, + Month: app.Config.Date.Month, + Day: app.Config.Date.Day, }) if err != nil { fmt.Printf("Error getting historical data: %v", err)