diff options
author | Vlad Uspensky <v.uspenskiy@icloud.com> | 2017-02-10 16:36:51 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-10 16:36:51 -0800 |
commit | 6554b26e100ff7cf1b81eff5c1e895a11b878d15 (patch) | |
tree | ca84f159d76ea6e751caa5f06afa64acff4ca837 /src/test/scala/xyz/driver/core/TimeTest.scala | |
parent | 4adc14f77762f48436f3c56f9328a6e4bedfe824 (diff) | |
parent | c67fb0d8e6779191620d5485f21003a2a0d9573d (diff) | |
download | driver-core-6554b26e100ff7cf1b81eff5c1e895a11b878d15.tar.gz driver-core-6554b26e100ff7cf1b81eff5c1e895a11b878d15.tar.bz2 driver-core-6554b26e100ff7cf1b81eff5c1e895a11b878d15.zip |
Merge pull request #20 from drivergroup/hhuang/date-orderingv0.10.7
Add the companion ordering object for Date
Diffstat (limited to 'src/test/scala/xyz/driver/core/TimeTest.scala')
-rw-r--r-- | src/test/scala/xyz/driver/core/TimeTest.scala | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/test/scala/xyz/driver/core/TimeTest.scala b/src/test/scala/xyz/driver/core/TimeTest.scala index 76ef42c..b83137c 100644 --- a/src/test/scala/xyz/driver/core/TimeTest.scala +++ b/src/test/scala/xyz/driver/core/TimeTest.scala @@ -84,4 +84,20 @@ class TimeTest extends FlatSpec with Matchers with Checkers { TimeRange(Time(432L), Time(321L)).duration should be((-111).milliseconds) TimeRange(Time(333L), Time(333L)).duration should be(0.milliseconds) } + + "Time" should "use TimeZone correctly when converting to Date" in { + + val EST = java.util.TimeZone.getTimeZone("EST") + val PST = java.util.TimeZone.getTimeZone("PST") + + val timestamp = { + import java.util.Calendar + val cal = Calendar.getInstance(EST) + cal.set(Calendar.HOUR_OF_DAY, 1) + Time(cal.getTime().getTime()) + } + + textualDate(EST)(timestamp) should not be textualDate(PST)(timestamp) + timestamp.toDate(EST) should not be timestamp.toDate(PST) + } } |