Skip to content

Commit

Permalink
Send dates instead of instants in /api/timeseries/calendar (#264)
Browse files Browse the repository at this point in the history
Fixes a calendar display bug that occurred in some timezones
  • Loading branch information
Adrien Surée authored Apr 4, 2018
1 parent 6bcee28 commit cf019f1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion core/src/main/scala/com/criteo/cuttle/App.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.criteo.cuttle

import java.time.Instant
import java.time.{Instant, LocalDate}

import scala.concurrent.duration._
import scala.util._
Expand Down Expand Up @@ -58,6 +58,11 @@ private[cuttle] object App {
date.toString.asJson
}

implicit val dateEncoder = new Encoder[LocalDate] {
override def apply(date: LocalDate) =
date.toString.asJson
}

implicit lazy val executionLogEncoder: Encoder[ExecutionLog] = new Encoder[ExecutionLog] {
override def apply(execution: ExecutionLog) =
Json.obj(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ private[timeseries] trait TimeSeriesApp { self: TimeSeriesScheduler =>
if (completion == 0 && done != 0) 0.1
else completion
Map(
"date" -> date.asJson,
"date" -> date.atZone(UTC).toLocalDate.asJson,
"completion" -> correctedCompletion.asJson
) ++ (if (stuck) Map("stuck" -> true.asJson) else Map.empty) ++
(if (backfillDomain.intersect(Interval(date, Daily(UTC).next(date))).toList.nonEmpty)
Expand Down

0 comments on commit cf019f1

Please sign in to comment.