Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: DatePicker.test fails with daylight savings change (#7399) #7401

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions packages/@react-spectrum/datepicker/test/DatePicker.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import {act, fireEvent, pointerMap, render as render_, waitFor, within} from '@react-spectrum/test-utils-internal';
import {Button} from '@react-spectrum/button';
import {CalendarDate, CalendarDateTime, EthiopicCalendar, getLocalTimeZone, JapaneseCalendar, parseZonedDateTime, toCalendarDateTime, today} from '@internationalized/date';
import {CalendarDate, CalendarDateTime, DateFormatter, EthiopicCalendar, getLocalTimeZone, JapaneseCalendar, parseZonedDateTime, toCalendarDateTime, today} from '@internationalized/date';
import {DatePicker} from '../';
import {Form} from '@react-spectrum/form';
import {Provider} from '@react-spectrum/provider';
Expand Down Expand Up @@ -584,7 +584,7 @@ describe('DatePicker', function () {
let month = parts.find(p => p.type === 'month').value;
let day = parts.find(p => p.type === 'day').value;
let year = parts.find(p => p.type === 'year').value;

expectPlaceholder(combobox, `${month}/${day}/${year}, 12:00 AM`);

await user.keyboard('{ArrowRight}');
Expand Down Expand Up @@ -1928,7 +1928,17 @@ describe('DatePicker', function () {
await user.tab();
await user.keyboard('{Backspace}');

expectPlaceholder(combobox, 'mm/dd/yyyy, ––:–– AM PDT');
let timeZoneName =
new DateFormatter('en-US',
{
timeZone: 'America/Los_Angeles',
timeZoneName: 'short'
})
.formatToParts(new Date())
.find(p => p.type === 'timeZoneName')
.value;

expectPlaceholder(combobox, `mm/dd/yyyy, ––:–– AM ${timeZoneName}`);
});

it('should keep timeZone from defaultValue when date and time are cleared then set', async function () {
Expand Down