Commit 625507e8 authored by Konstantin Tskhovrebov's avatar Konstantin Tskhovrebov 🤖

Update OffsetDateTimeDeserializer for all ISO formats.

parent c1365b10
......@@ -4,16 +4,13 @@ import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
import org.threeten.bp.OffsetDateTime
import org.threeten.bp.format.DateTimeFormatter
import java.lang.reflect.Type
class OffsetDateTimeDeserializer : JsonDeserializer<OffsetDateTime> {
private val dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSX")
override fun deserialize(
json: JsonElement,
typeOfT: Type,
context: JsonDeserializationContext?
): OffsetDateTime = OffsetDateTime.parse(json.asJsonPrimitive.asString, dateTimeFormatter)
): OffsetDateTime = OffsetDateTime.parse(json.asJsonPrimitive.asString)
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment