aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksandr <ognelisar@gmail.com>2018-04-09 10:51:51 +0700
committerAleksandr <ognelisar@gmail.com>2018-04-09 10:51:51 +0700
commitfc7355c69eeab8334ea066a434476d227e9dc399 (patch)
tree6ef427e3f2943580fd4539d04f05754c92832d6b
parentad98b2237751adc7fcc1e9dfed437c8ff1f28f29 (diff)
downloaddriver-core-fc7355c69eeab8334ea066a434476d227e9dc399.tar.gz
driver-core-fc7355c69eeab8334ea066a434476d227e9dc399.tar.bz2
driver-core-fc7355c69eeab8334ea066a434476d227e9dc399.zip
Fixed toCalendar method of TimeOfDay class
-rw-r--r--src/main/scala/xyz/driver/core/time.scala1
-rw-r--r--src/test/scala/xyz/driver/core/TimeTest.scala3
2 files changed, 4 insertions, 0 deletions
diff --git a/src/main/scala/xyz/driver/core/time.scala b/src/main/scala/xyz/driver/core/time.scala
index bab304d..6dbd173 100644
--- a/src/main/scala/xyz/driver/core/time.scala
+++ b/src/main/scala/xyz/driver/core/time.scala
@@ -92,6 +92,7 @@ object time {
private def toCalendar(day: Int, month: Int, year: Int): Calendar = {
val cal = Calendar.getInstance(timeZone)
cal.set(year, month, day, localTime.getHour, localTime.getMinute, localTime.getSecond)
+ cal.clear(Calendar.MILLISECOND)
cal
}
}
diff --git a/src/test/scala/xyz/driver/core/TimeTest.scala b/src/test/scala/xyz/driver/core/TimeTest.scala
index b72fde8..5552a7d 100644
--- a/src/test/scala/xyz/driver/core/TimeTest.scala
+++ b/src/test/scala/xyz/driver/core/TimeTest.scala
@@ -74,6 +74,9 @@ class TimeTest extends FlatSpec with Matchers with Checkers {
}
it should "have correct textual representations" in {
+ import java.util.Locale
+ import java.util.Locale._
+ Locale.setDefault(US)
textualDate(TimeZone.getTimeZone("EDT"))(Time(1468937089834L)) should be("July 19, 2016")
textualTime(TimeZone.getTimeZone("PDT"))(Time(1468937089834L)) should be("Jul 19, 2016 02:04:49 PM")