You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in the above file in the extension function toWeatherInfo
fun WeatherDto.toWeatherInfo(): WeatherInfo { val weatherDataMap = weatherData.toWeatherDataMap() val now = LocalDateTime.now() val currentWeatherData = weatherDataMap[0]?.find { val hour = if(now.minute < 30) now.hour else now.hour + 1 it.time.hour == hour } return WeatherInfo( weatherDataPerDay = weatherDataMap, currentWeatherData = currentWeatherData ) }
here if time is between 23 : 30 and 00:00 am it will return null cause since it is > 30 minutes it will go to hour plus 1 which is 24 but there is no 24th hour, it's 0th hour. So it will return null.
The text was updated successfully, but these errors were encountered:
app/src/main/java/com/plcoding/weatherapp/data/mappers/WeatherMappers.kt
in the above file in the extension function toWeatherInfo
fun WeatherDto.toWeatherInfo(): WeatherInfo { val weatherDataMap = weatherData.toWeatherDataMap() val now = LocalDateTime.now() val currentWeatherData = weatherDataMap[0]?.find { val hour = if(now.minute < 30) now.hour else now.hour + 1 it.time.hour == hour } return WeatherInfo( weatherDataPerDay = weatherDataMap, currentWeatherData = currentWeatherData ) }
here if time is between 23 : 30 and 00:00 am it will return null cause since it is > 30 minutes it will go to hour plus 1 which is 24 but there is no 24th hour, it's 0th hour. So it will return null.
The text was updated successfully, but these errors were encountered: