Skip to content

Commit

Permalink
fixes #229 -- parse utc timestamps into localtime
Browse files Browse the repository at this point in the history
  • Loading branch information
sphrak committed Oct 30, 2020
1 parent 2e549ed commit 23b5396
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@ import fi.kroon.vadret.util.WINDCHILL_FORMULA_MINIMUM
import fi.kroon.vadret.util.common.SunsetUtil
import fi.kroon.vadret.util.extension.parseToLocalDate
import fi.kroon.vadret.util.extension.toWindChill
import org.threeten.bp.Instant
import org.threeten.bp.OffsetDateTime
import org.threeten.bp.ZoneId
import java.text.SimpleDateFormat
import java.util.Calendar
import java.util.Date
import java.util.Locale
import java.util.TimeZone

object WeatherForecastMapper {

Expand Down Expand Up @@ -160,7 +165,7 @@ object WeatherForecastMapper {

private fun getWeatherForecastItemModel(timeSerie: TimeSerie): WeatherForecastItemModel {
var temperature: Double = 0.0
val time: String = OffsetDateTime.parse(timeSerie.validTime).toLocalTime().toString()
val time: String = Instant.parse(timeSerie.validTime).atZone(ZoneId.systemDefault()).toLocalTime().toString()
var feelsLikeTemperature: String? = null
var windSpeed: Double = 0.0
val precipitationType: Int = 0
Expand Down

0 comments on commit 23b5396

Please sign in to comment.