This commit is contained in:
@ -33,14 +33,18 @@ func (awn *AWNProvider) ReqToWeather(_ context.Context, r *http.Request) (
|
||||
}
|
||||
|
||||
func MapAwnUpdate(awnUpdate *AmbientWeatherUpdate) *weather.WeatherUpdate {
|
||||
updateTime, err := time.Parse(time.DateTime, awnUpdate.DateUTC)
|
||||
if err != nil {
|
||||
updateTime = time.Now()
|
||||
updateTime := time.Now()
|
||||
if awnUpdate.DateUTC != nil {
|
||||
ut, err := time.Parse(time.DateTime, *awnUpdate.DateUTC)
|
||||
if err == nil {
|
||||
updateTime = ut
|
||||
}
|
||||
}
|
||||
|
||||
return &weather.WeatherUpdate{
|
||||
StationType: awnUpdate.StationType,
|
||||
DateUTC: &updateTime,
|
||||
StationID: awnUpdate.PassKey,
|
||||
StationType: awnUpdate.StationType,
|
||||
TempOutdoorF: awnUpdate.TempF,
|
||||
HumidityOudoor: awnUpdate.Humidity,
|
||||
WindSpeedMPH: awnUpdate.WindSpeedMPH,
|
||||
|
Reference in New Issue
Block a user