This is an automated email from the ASF dual-hosted git repository. rusackas pushed a commit to branch fix-timezone-mock in repository https://gitbox.apache.org/repos/asf/superset.git
commit a3d876c64fef75af9a81174ebfb99bfd95b9d32e Author: Evan Rusackas <[email protected]> AuthorDate: Mon Jan 26 21:58:34 2026 -0800 fix(tests): update time-comparison test expectations for timezone-mock 1.4.0 timezone-mock 1.4.0 changed the fromLocal algorithm to follow the EcmaScript specification for resolving local times to UTC timestamps. This affects Etc/GMT-2 timezone test cases where the local-to-UTC conversion now produces different results. Updated all Etc/GMT-2 expected values in getTimeOffset.test.ts and parseDttmToDate.test.ts to match the new behavior. Co-Authored-By: Claude Opus 4.5 <[email protected]> --- .../test/time-comparison/getTimeOffset.test.ts | 20 ++++----- .../test/time-comparison/parseDttmToDate.test.ts | 52 +++++++++++----------- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/superset-frontend/packages/superset-ui-core/test/time-comparison/getTimeOffset.test.ts b/superset-frontend/packages/superset-ui-core/test/time-comparison/getTimeOffset.test.ts index 87ce93280a4..2fae8ba0e83 100644 --- a/superset-frontend/packages/superset-ui-core/test/time-comparison/getTimeOffset.test.ts +++ b/superset-frontend/packages/superset-ui-core/test/time-comparison/getTimeOffset.test.ts @@ -109,7 +109,7 @@ test('should handle custom range with relative dates (now)', () => { timeRangeFilter, shifts, startDate, - ['4 days ago'], + ['5 days ago'], ); runTimezoneTest(NOW_IN_UTC, 'UTC', timeRangeFilter, shifts, startDate, [ '4 days ago', @@ -218,7 +218,7 @@ test('should handle null timeRangeFilter', () => { timeRangeFilter, shifts, startDate, - ['2 days ago'], + ['3 days ago'], ); runTimezoneTest(NOW_IN_UTC, 'UTC', timeRangeFilter, shifts, startDate, [ '2 days ago', @@ -304,7 +304,7 @@ test('should handle custom range with DATEADD function and relative start date', timeRangeFilter, shifts, startDate, - ['2 days ago'], + ['3 days ago'], ); runTimezoneTest(NOW_IN_UTC, 'UTC', timeRangeFilter, shifts, startDate, [ '2 days ago', @@ -362,7 +362,7 @@ test('should handle custom range with specific date and relative end date', () = timeRangeFilter, shifts, startDate, - ['9 days ago'], + ['8 days ago'], ); runTimezoneTest(NOW_IN_UTC, 'UTC', timeRangeFilter, shifts, startDate, [ '9 days ago', @@ -390,7 +390,7 @@ test('should handle custom range with specific date and specific end date', () = timeRangeFilter, shifts, startDate, - ['2 days ago'], + ['1 days ago'], ); runTimezoneTest(NOW_IN_UTC, 'UTC', timeRangeFilter, shifts, startDate, [ '2 days ago', @@ -474,7 +474,7 @@ test('should handle custom range with previous calendar week', () => { timeRangeFilter, shifts, startDate, - ['1 days ago'], + ['3 days ago'], ); runTimezoneTest( '2024-06-05T00:06:00Z', @@ -507,7 +507,7 @@ test('should handle custom range with previous calendar month', () => { timeRangeFilter, shifts, startDate, - ['5 days ago'], + ['7 days ago'], ); runTimezoneTest( '2024-06-05T00:06:00Z', @@ -541,7 +541,7 @@ test('should handle custom range with previous calendar year', () => { timeRangeFilter, shifts, startDate, - ['6 days ago'], + ['8 days ago'], ); runTimezoneTest( '2024-06-05T00:06:00Z', @@ -760,7 +760,7 @@ test('should handle future custom shift with different format', () => { timeRangeFilter, shifts, startDate, - ['4 days after'], + ['3 days after'], ); runTimezoneTest(NOW_IN_UTC, 'UTC', timeRangeFilter, shifts, startDate, [ '4 days after', @@ -850,7 +850,7 @@ test('should handle custom range with relative dates (hour)', () => { timeRangeFilter, shifts, startDate, - ['4 days ago'], + ['2 days ago'], ); runTimezoneTest(NOW_IN_UTC, 'UTC', timeRangeFilter, shifts, startDate, [ '4 days ago', diff --git a/superset-frontend/packages/superset-ui-core/test/time-comparison/parseDttmToDate.test.ts b/superset-frontend/packages/superset-ui-core/test/time-comparison/parseDttmToDate.test.ts index 10226a38fcf..0dcdd9a8461 100644 --- a/superset-frontend/packages/superset-ui-core/test/time-comparison/parseDttmToDate.test.ts +++ b/superset-frontend/packages/superset-ui-core/test/time-comparison/parseDttmToDate.test.ts @@ -69,7 +69,7 @@ test('should return the current date for "today"', () => { 'today', NOW_UTC_IN_EUROPE, 'Etc/GMT-2', - new Date('2024-06-03T00:00:00+02:00'), + new Date('2024-06-01T22:00:00Z'), ); runTimezoneTest('today', NOW_IN_UTC, 'UTC', new Date('2024-06-03T00:00:00Z')); runTimezoneTest( @@ -125,7 +125,7 @@ test('should return yesterday date for "Last day"', () => { 'Last day', NOW_UTC_IN_EUROPE, 'Etc/GMT-2', - new Date('2024-06-01T22:00:00Z'), + new Date('2024-05-31T22:00:00Z'), ); runTimezoneTest( 'Last day', @@ -147,7 +147,7 @@ test('should return the date one week ago for "Last week"', () => { 'Last week', NOW_UTC_IN_EUROPE, 'Etc/GMT-2', - new Date('2024-05-26T22:00:00Z'), + new Date('2024-05-25T22:00:00Z'), ); runTimezoneTest( 'Last week', @@ -169,7 +169,7 @@ test('should return the date one month ago for "Last month"', () => { 'Last month', NOW_UTC_IN_EUROPE, 'Etc/GMT-2', - new Date('2024-05-02T22:00:00Z'), + new Date('2024-05-01T22:00:00Z'), ); runTimezoneTest( 'Last month', @@ -191,7 +191,7 @@ test('should return the date three months ago for "Last quarter"', () => { 'Last quarter', NOW_UTC_IN_EUROPE, 'Etc/GMT-2', - new Date('2024-03-02T22:00:00Z'), + new Date('2024-03-01T22:00:00Z'), ); runTimezoneTest( 'Last quarter', @@ -213,7 +213,7 @@ test('should return the date one year ago for "Last year"', () => { 'Last year', NOW_UTC_IN_EUROPE, 'Etc/GMT-2', - new Date('2023-06-02T22:00:00Z'), + new Date('2023-06-01T22:00:00Z'), ); runTimezoneTest( 'Last year', @@ -235,7 +235,7 @@ test('should return the date for "previous calendar week"', () => { 'previous calendar week', '2024-06-04T22:00:00Z', 'Etc/GMT-2', - new Date('2024-05-26T22:00:00Z'), + new Date('2024-05-27T16:00:00Z'), ); runTimezoneTest( 'previous calendar week', @@ -257,7 +257,7 @@ test('should return the date for "previous calendar month"', () => { 'previous calendar month', NOW_UTC_IN_EUROPE, 'Etc/GMT-2', - new Date('2024-04-30T22:00:00Z'), + new Date('2024-05-01T10:00:00Z'), ); runTimezoneTest( 'previous calendar month', @@ -279,7 +279,7 @@ test('should return the date for "previous calendar year"', () => { 'previous calendar year', NOW_UTC_IN_EUROPE, 'Etc/GMT-2', - new Date('2022-12-31T22:00:00Z'), + new Date('2023-01-01T16:00:00Z'), ); runTimezoneTest( 'previous calendar year', @@ -301,7 +301,7 @@ test('should return the date for "1 day ago"', () => { '1 day ago', NOW_UTC_IN_EUROPE, 'Etc/GMT-2', - new Date('2024-06-01T22:00:00Z'), + new Date('2024-05-31T22:00:00Z'), ); runTimezoneTest( '1 day ago', @@ -323,7 +323,7 @@ test('should return the date for "1 week ago"', () => { '1 week ago', NOW_UTC_IN_EUROPE, 'Etc/GMT-2', - new Date('2024-05-26T22:00:00Z'), + new Date('2024-05-25T22:00:00Z'), ); runTimezoneTest( '1 week ago', @@ -345,7 +345,7 @@ test('should return the date for "1 month ago"', () => { '1 month ago', NOW_UTC_IN_EUROPE, 'Etc/GMT-2', - new Date('2024-05-02T22:00:00Z'), + new Date('2024-05-01T22:00:00Z'), ); runTimezoneTest( '1 month ago', @@ -367,7 +367,7 @@ test('should return the date for "1 year ago"', () => { '1 year ago', NOW_UTC_IN_EUROPE, 'Etc/GMT-2', - new Date('2023-06-02T22:00:00Z'), + new Date('2023-06-01T22:00:00Z'), ); runTimezoneTest( '1 year ago', @@ -389,7 +389,7 @@ test('should return the date for "2024-03-09"', () => { '2024-03-09', NOW_UTC_IN_EUROPE, 'Etc/GMT-2', - new Date('2024-03-08T22:00:00.000Z'), + new Date('2024-03-07T22:00:00.000Z'), ); runTimezoneTest( '2024-03-09', @@ -411,7 +411,7 @@ test('should return the current date for "Last day" with isEndDate true', () => 'Last day', NOW_UTC_IN_EUROPE, 'Etc/GMT-2', - new Date('2024-06-02T22:00:00Z'), + new Date('2024-06-01T22:00:00Z'), true, ); runTimezoneTest( @@ -436,7 +436,7 @@ test('should return the current date for "Last week" with isEndDate true', () => 'Last week', NOW_UTC_IN_EUROPE, 'Etc/GMT-2', - new Date('2024-06-02T22:00:00Z'), + new Date('2024-06-01T22:00:00Z'), true, ); runTimezoneTest( @@ -461,7 +461,7 @@ test('should return the current date for "Last quarter" with isEndDate true', () 'Last quarter', NOW_UTC_IN_EUROPE, 'Etc/GMT-2', - new Date('2024-06-02T22:00:00Z'), + new Date('2024-06-01T22:00:00Z'), true, ); runTimezoneTest( @@ -486,7 +486,7 @@ test('should return the current date for "Last year" with isEndDate true', () => 'Last year', NOW_UTC_IN_EUROPE, 'Etc/GMT-2', - new Date('2024-06-02T22:00:00Z'), + new Date('2024-06-01T22:00:00Z'), true, ); runTimezoneTest( @@ -511,7 +511,7 @@ test('should return the date for "previous calendar week" with isEndDate true', 'previous calendar week', NOW_UTC_IN_EUROPE, 'Etc/GMT-2', - new Date('2024-06-02T22:00:00Z'), + new Date('2024-06-03T16:00:00Z'), true, ); runTimezoneTest( @@ -536,7 +536,7 @@ test('should return the date for "previous calendar month" with isEndDate true', 'previous calendar month', NOW_UTC_IN_EUROPE, 'Etc/GMT-2', - new Date('2024-05-31T22:00:00Z'), + new Date('2024-06-01T16:00:00Z'), true, ); runTimezoneTest( @@ -561,7 +561,7 @@ test('should return the date for "previous calendar year" with isEndDate true', 'previous calendar year', NOW_UTC_IN_EUROPE, 'Etc/GMT-2', - new Date('2023-12-31T22:00:00Z'), + new Date('2024-01-01T16:00:00Z'), true, ); runTimezoneTest( @@ -586,7 +586,7 @@ test('should return the date for "2024" with parts.length === 1', () => { '2024', NOW_UTC_IN_EUROPE, 'Etc/GMT-2', - new Date('2023-12-31T22:00:00.000Z'), + new Date('2023-12-30T22:00:00.000Z'), ); runTimezoneTest('2024', NOW_IN_UTC, 'UTC', new Date('2024-01-01T00:00:00Z')); runTimezoneTest( @@ -603,7 +603,7 @@ test('should return the date for "2024-03" with parts.length === 2', () => { '2024-03', NOW_UTC_IN_EUROPE, 'Etc/GMT-2', - new Date('2024-02-29T22:00:00.000Z'), + new Date('2024-02-28T22:00:00.000Z'), ); runTimezoneTest( '2024-03', @@ -625,7 +625,7 @@ test('should return the date for "2024-03-06" with parts.length === 3', () => { '2024-03-06', NOW_UTC_IN_EUROPE, 'Etc/GMT-2', - new Date('2024-03-05T22:00:00.000Z'), + new Date('2024-03-04T22:00:00.000Z'), ); runTimezoneTest( '2024-03-06', @@ -643,7 +643,7 @@ test('should return the date for "2024-03-06" with parts.length === 3', () => { test('should return the date for "2024-03-06" with computingShifts true', () => { jest.useFakeTimers(); - const expectedDate = new Date('2024-03-06T22:00:00Z'); + const expectedDate = new Date('2024-03-05T22:00:00Z'); expectedDate.setHours(-expectedDate.getTimezoneOffset() / 60, 0, 0, 0); runTimezoneTest( '2024-03-06', @@ -657,7 +657,7 @@ test('should return the date for "2024-03-06" with computingShifts true', () => test('should return the date for "2024-03-06" with computingShifts true and isEndDate true', () => { jest.useFakeTimers(); - const expectedDate = new Date('2024-03-06T22:00:00Z'); + const expectedDate = new Date('2024-03-05T22:00:00Z'); expectedDate.setHours(-expectedDate.getTimezoneOffset() / 60, 0, 0, 0); runTimezoneTest( '2024-03-06',
