Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
fix(clock): format an explicit timestamp of 0 as the epoch in Intl.DateTimeFormat (#43431)
Yury Semikhatsky754c170d8306
diff --git a/packages/injected/src/clock.ts b/packages/injected/src/clock.tsindex a322e34778..e7cf87b1de 100644--- a/packages/injected/src/clock.ts+++ b/packages/injected/src/clock.ts@@ -567,8 +567,8 @@ function createIntl(clock: ClockController, NativeIntl: Builtins['Intl']): BuiltformatRange: realFormatter.formatRange.bind(realFormatter),formatRangeToParts: realFormatter.formatRangeToParts.bind(realFormatter),resolvedOptions: realFormatter.resolvedOptions.bind(realFormatter),- format: date => realFormatter.format(date || clock.now()),- formatToParts: date => realFormatter.formatToParts(date || clock.now()),+ format: date => realFormatter.format(date === undefined ? clock.now() : date),+ formatToParts: date => realFormatter.formatToParts(date === undefined ? clock.now() : date),};return formatter;diff --git a/tests/library/unit/clock.spec.ts b/tests/library/unit/clock.spec.tsindex e4acdc5480..e46a0ee982 100644--- a/tests/library/unit/clock.spec.ts+++ b/tests/library/unit/clock.spec.ts@@ -1662,6 +1662,9 @@ it.describe('Intl API', () => {// June 1 04:00 UTC - Toronto is June 1 00:00install(Date.UTC(2022, 5, 1, 4));expect(isFirstOfMonth('America/Toronto')).toBeTruthy();+ // A timestamp of 0 is the epoch, not "use the system time".+ // https://github.com/microsoft/playwright/issues/43424+ expect(isFirstOfMonth('America/Toronto', 0)).toBeFalsy();});it('formatToParts via isFirstOfMonth -> Returns false when passed no timestamp and system time is not first of the month', async ({ install }) => {