Skip to content

Commit 74791f1

Browse files
committed
Bugfix of Timezone issue
1 parent f2c07d3 commit 74791f1

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/main/scala/codecheck/github/models/Issue.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import org.json4s.JInt
88
import org.json4s.JArray
99
import org.json4s.JsonDSL._
1010
import org.joda.time.DateTime
11+
import org.joda.time.DateTimeZone
1112

1213
import codecheck.github.utils.ToDo
1314

@@ -77,7 +78,7 @@ case class IssueListOption(
7778
) {
7879
def q = s"?filter=$filter&state=$state&sort=$sort&direction=$direction" +
7980
(if (!labels.isEmpty) "&labels=" + labels.mkString(",") else "") +
80-
(if (!since.isEmpty) (since map ("&since=" + _.toString("yyyy-MM-dd'T'HH:mm:ss'Z'"))).get else "")
81+
(if (!since.isEmpty) (since map ("&since=" + _.toDateTime(DateTimeZone.UTC).toString("yyyy-MM-dd'T'HH:mm:ss'Z'"))).get else "")
8182
}
8283

8384
case class IssueListOption4Repository(
@@ -99,7 +100,7 @@ case class IssueListOption4Repository(
99100
(if (!labels.isEmpty) "&labels=" + labels.mkString(",") else "") +
100101
s"&sort=$sort" +
101102
s"&direction=$direction" +
102-
(if (!since.isEmpty) (since map ("&since=" + _.toString("yyyy-MM-dd'T'HH:mm:ss'Z'"))).get else "")
103+
(if (!since.isEmpty) (since map ("&since=" + _.toDateTime(DateTimeZone.UTC).toString("yyyy-MM-dd'T'HH:mm:ss'Z'"))).get else "")
103104
}
104105

105106
case class IssueInput(

src/test/scala/IssueOpSpec.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class IssueOpSpec extends FunSpec with Constants with BeforeAndAfterAll {
2222
val number = 1
2323
var nUser: Long = 0
2424
var nOrg: Long = 0
25-
var nTime: DateTime = DateTime.now().toDateTime(DateTimeZone.UTC)
25+
var nTime: DateTime = DateTime.now
2626
val tRepo = repo + "2"
2727

2828
override def beforeAll() {
@@ -139,6 +139,7 @@ class IssueOpSpec extends FunSpec with Constants with BeforeAndAfterAll {
139139

140140
it("shold return only two issues when using options.") {
141141
val option = IssueListOption(IssueFilter.created, IssueState.open, Seq("question"), since=Some(nTime))
142+
println(option.q)
142143
val result = Await.result(api.listAllIssues(option), TIMEOUT)
143144
assert(result.length == 2)
144145
assert(result.head.title == "test issue")

0 commit comments

Comments
 (0)