Closed mahmoudmoravej closed 3 years ago
FWIW, I believe you can control this via env var. In the past, I've added TZ=UTC
in my test script to ensure timezone consistency (which was a minor issue when I was writing tests with my Sydney-based colleagues).
This has been discussed in #48 before and the most reliable solution is to set the TZ
environment variable, as @mAAdhaTTah mentioned. It's not possible to adjust the timezone from within JavaScript.
We have used this tool in order to support mocking system clock in our Jest tests. The problem is that our test files run in containers around the world with different timezones. So, it would be great if we could set the timezone in order to make our tests independent from location. This approach makes writing and understanding our test scenarios straightforward.