diff --git a/web_src/js/webcomponents/absolute-date.test.js b/web_src/js/webcomponents/absolute-date.test.js index dfd82e3cf1..95fb1a9017 100644 --- a/web_src/js/webcomponents/absolute-date.test.js +++ b/web_src/js/webcomponents/absolute-date.test.js @@ -18,9 +18,7 @@ test('toAbsoluteLocaleDate', () => { expect(toAbsoluteLocaleDate('10000-01-01', '', {})).toEqual('Invalid Date'); // test different timezone - const oldTZ = process.env.TZ; - process.env.TZ = 'America/New_York'; - expect(new Date('2024-03-15').toLocaleString()).toEqual('3/14/2024, 8:00:00 PM'); - expect(toAbsoluteLocaleDate('2024-03-15')).toEqual('3/15/2024, 12:00:00 AM'); - process.env.TZ = oldTZ; + vi.stubEnv('TZ', 'America/New_York'); + expect(new Date('2024-03-15').toLocaleString('en-US')).toEqual('3/14/2024, 8:00:00 PM'); + expect(toAbsoluteLocaleDate('2024-03-15', 'en-US')).toEqual('3/15/2024, 12:00:00 AM'); });