Hi again everyone. I asked a question a couple of ...
# general
j
Hi again everyone. I asked a question a couple of days ago, and I am almost done implementing the tests with different provider states as suggested by you! However, if I could get some more support I would be very thankful. I am currently adding datetime validation for my pact, but for some reason pact seems to add 2 hours to the example I provide:
Copy code
root.datetime("lastModifiedDate", DATETIME_FORMAT, DateUtil.toInstantFromDatetime("2022-06-27T12:30:10.767Z"))
JSON output from this is 2022-06-27T143010.767Z. Can someone explain to me how I can fix this?
m
Hello!
Looks like a JVM question so might be best asking in #C9UN99H24. What’s the DATETIME_FORMAT? Is it possible that’s playing a part here? Strange!
j
Hi Matt. DATETIME_FORMAT is "yyyy-MM-dd'T'HHmmss.SSS'Z'", I don't think this is relevant though. The DateUtil method toInstantFromDatetime is delivering this date in this format, in UTC. However Pact is somehow using the local time, instead of UTC. I was able to get it to work now by setting my system time to UTC with the runtime argument -Duser.timezone="UTC". I would however prefer if I could tell Pact which timezone to use. Is this possible? Edit: Also posted in #C9UN99H24
m
Thanks!
The core maintainer of JVM is on PTO at the moment, so might be worth a follow up Tuesday next week once he’s landed back here.
That’s an interesting insight though, perhaps it’s something Pact can’t control and is a Java system thing. Not sure
j
Alright, would be happy to get some more insights as well. I'll wait and see if some more answers come next week then :)