This commit is contained in:
@ -33,16 +33,21 @@ func (wu *WUProvider) ReqToWeather(_ context.Context, r *http.Request) (
|
||||
}
|
||||
|
||||
func MapWUUpdate(wuUpdate *WundergroundUpdate) *weather.WeatherUpdate {
|
||||
updateTime, err := time.Parse(time.DateTime, wuUpdate.DateUTC)
|
||||
if err != nil {
|
||||
updateTime = time.Now()
|
||||
updateTime := time.Now()
|
||||
|
||||
if wuUpdate.DateUTC != nil {
|
||||
ut, err := time.Parse(time.DateTime, *wuUpdate.DateUTC)
|
||||
if err == nil {
|
||||
updateTime = ut
|
||||
}
|
||||
}
|
||||
|
||||
return &weather.WeatherUpdate{
|
||||
StationType: wuUpdate.SoftwareType,
|
||||
DateUTC: &updateTime,
|
||||
TempOutdoorF: wuUpdate.Tempf,
|
||||
HumidityOudoor: wuUpdate.Humidity,
|
||||
StationID: wuUpdate.ID,
|
||||
StationType: wuUpdate.SoftwareType,
|
||||
TempOutdoorF: wuUpdate.Tempf,
|
||||
HumidityOudoor: wuUpdate.Humidity,
|
||||
WindSpeedMPH: wuUpdate.WindGustMPH,
|
||||
WindGustMPH: wuUpdate.WindGustMPH,
|
||||
WindDir: wuUpdate.WindDir,
|
||||
|
Reference in New Issue
Block a user