aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/common.scala
diff options
context:
space:
mode:
authorKseniya Tomskikh <ktomskih@datamonsters.co>2017-08-11 14:40:19 +0600
committerKseniya Tomskikh <ktomskih@datamonsters.co>2017-08-11 14:41:30 +0600
commitbfac6a54dcf37e0280cc8f2ec6ff3802dc8e8dfe (patch)
tree2d66348851ad61b43cc0cb114aa56537cedad926 /src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/common.scala
parent9e60edb6216fce615b13f9bcc68d8f86258b85c3 (diff)
downloadrest-query-bfac6a54dcf37e0280cc8f2ec6ff3802dc8e8dfe.tar.gz
rest-query-bfac6a54dcf37e0280cc8f2ec6ff3802dc8e8dfe.tar.bz2
rest-query-bfac6a54dcf37e0280cc8f2ec6ff3802dc8e8dfe.zip
PDSUI-2188 Created and fixed test for json formats for ReP and TM
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/common.scala')
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/common.scala7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/common.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/common.scala
index 4dadb11..dbd0a43 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/common.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/sprayformats/common.scala
@@ -1,7 +1,6 @@
package xyz.driver.pdsuidomain.formats.json.sprayformats
-import java.time.format.DateTimeFormatter
-import java.time.{LocalDate, LocalDateTime, ZonedDateTime}
+import java.time.{LocalDate, LocalDateTime, ZoneId, ZonedDateTime}
import spray.json._
import xyz.driver.pdsuicommon.domain.{FuzzyValue, LongId, StringId, UuidId}
@@ -33,9 +32,9 @@ object common {
}
implicit def dateTimeFormat = new RootJsonFormat[LocalDateTime] {
- override def write(date: LocalDateTime): JsString = JsString(date.toString)
+ override def write(date: LocalDateTime): JsString = JsString(ZonedDateTime.of(date, ZoneId.of("Z")).toString)
override def read(json: JsValue): LocalDateTime = json match {
- case JsString(value) => LocalDateTime.parse(value)
+ case JsString(value) => ZonedDateTime.parse(value).toLocalDateTime
case _ => deserializationError(s"Expected date as LocalDateTime, but got $json")
}
}