Skip to content

Commit 8d7dd48

Browse files
committed
Explain better last timezone test
1 parent 2ba1280 commit 8d7dd48

File tree

1 file changed

+5
-4
lines changed
  • packages/components/src/calendar/test

1 file changed

+5
-4
lines changed

packages/components/src/calendar/test/index.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -738,13 +738,14 @@ describe( 'DateCalendar', () => {
738738
} );
739739

740740
it( 'should handle timezoned dates and convert them to the calendar timezone', async () => {
741+
// Still the same time from UTC's POV, just expressed in Tokyo time.
741742
const tomorrowAtMidnightInTokyo = new TZDate( tomorrow, 'Asia/Tokyo' );
742743

743-
render( <DateCalendar defaultSelected={ tomorrowAtMidnightInTokyo } /> );
744+
render( <DateCalendar defaultSelected={ tomorrowAtMidnightInTokyo } timeZone="-02:00" /> );
744745

745-
// Tomorrow at midnight in Tokyo is today
746-
// for the calendar (set to UTC by default);
747-
expect( getDateButton( today ) ).toHaveAccessibleName( /today/i );
746+
// Changing the calendar timezone to UTC-2 makes the dates become
747+
// earlier by 1 day (from midnight to 10pm the previous day).
748+
expect( getDateCell( today, { selected: true } ) ).toBeVisible();
748749
} );
749750
} );
750751
} );

0 commit comments

Comments
 (0)