Switch to always using UTC date display

This commit is contained in:
Adam Gastineau 2025-01-10 10:11:32 -08:00
parent 258699cdb4
commit 0100f87e11
2 changed files with 9 additions and 7 deletions

View file

@ -31,7 +31,9 @@ const formatClockParams = (params: {
} else if (params.timeNumber !== undefined) {
// clock.pauseAt/setFixedTime/setSystemTime
try {
return new Date(params.timeNumber).toLocaleString();
return new Date(params.timeNumber).toLocaleString(undefined, {
timeZone: 'UTC',
});
} catch (e) {
return undefined;
}

View file

@ -188,10 +188,10 @@ test('should show action context on locators and other common actions', async ({
await page.mouse.up();
await page.clock.fastForward(1000);
await page.clock.fastForward('30:00');
await page.clock.pauseAt(new Date('2020-02-02'));
await page.clock.pauseAt(new Date('2020-02-02T00:00:00Z'));
await page.clock.runFor(10);
await page.clock.setFixedTime(new Date('2020-02-02'));
await page.clock.setSystemTime(new Date('2020-02-02'));
await page.clock.setFixedTime(new Date('2020-02-02T00:00:00Z'));
await page.clock.setSystemTime(new Date('2020-02-02T00:00:00Z'));
});
await expect(traceViewer.actionTitles).toHaveText([
@ -210,10 +210,10 @@ test('should show action context on locators and other common actions', async ({
/mouse.up/,
/clock.fastForward1000ms/,
/clock.fastForward30:00/,
/clock.pauseAt2\/1\/2020, 4:00:00 PM/,
/clock.pauseAt2\/2\/2020, 12:00:00 AM/,
/clock.runFor10ms/,
/clock.setFixedTime2\/1\/2020, 4:00:00 PM/,
/clock.setSystemTime2\/1\/2020, 4:00:00 PM/
/clock.setFixedTime2\/2\/2020, 12:00:00 AM/,
/clock.setSystemTime2\/2\/2020, 12:00:00 AM/,
]);
});