I am trying to set the timezone on the process.env object but it does not seem to work.
The following code is run as a JEST test, however it should still be relevant to node processes (right?).
If I set TZ to UTC, then the date I create is still my current timezone and not UTC. See below :
describe('Timezones', () => {
it('should always be UTC', () => {
process.env.TZ = 'UTC'
let d = new Date();
expect(d.getTimezoneOffset()).toBe(0); //ERROR!!! 120 minutes out... ie. Europe/Berlin where i am
});
})