rusackas commented on PR #37333:
URL: https://github.com/apache/superset/pull/37333#issuecomment-3866350750
Why the test changes show a "day different" - What changed in v1.4.0
Looking at the PR changes, there's a critical change in the test setup order:
apache / superset / files
// BEFORE (v1.3.6):
- jest.setSystemTime(new Date(now_time));
timezoneMock.register(timezone);
+ jest.setSystemTime(new Date(now_time));
// AFTER (v1.4.0):
The key change: In timezone-mock v1.4.0, you must register the timezone
BEFORE setting the system time. This affects how dates are interpreted:
When you create new Date('2024-06-03T00:00:00Z') in different timezones, the
resulting date object shifts
The v1.4.0 release likely fixed a bug where timezone registration wasn't
properly affecting Date construction
Tests are now correctly accounting for timezone offsets, which is why dates
shift by ~1 day in some cases
Should you be nervous?
No, you shouldn't be nervous. Here's why:
This is a test-only change - The timezone-mock package is in
devDependencies, so it only affects tests
The tests are being updated to match the correct behavior - The library is
now properly simulating timezones
The actual application code hasn't changed - Only test expectations are
being adjusted to match more accurate timezone mocking
The pattern in all the test changes is consistent: they're adjusting
expected values to account for proper timezone handling that v1.4.0 now
provides. This is actually a good thing - it means your tests are now more
accurately validating that timezone-sensitive code works correctly.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]