Description
Provide a general summary of the issue here
The following test fails when the defaultValue
timeZone's daylight savings/standard time does not match the current timeZone's standard/daylight savings time.
react-spectrum/packages/@react-spectrum/datepicker/test/DatePicker.test.js
Lines 1897 to 1932 in f33288c
🤔 Expected Behavior?
If the defaultValue
is on daylight savings time and the user clears the value while in a time zone on standard time, the DatePicker's time zone will change to standard time. I think this is the correct behavior, however, the test is written to always expect "PDT" Pacific Daylight Savings Time, which means it will fail when we're on standard time.
😯 Current Behavior
The test is written to always expect "PDT" Pacific Daylight Savings Time, which means it will fail when we're on standard time.
💁 Possible Solution
Use the timeZoneName
for the current date time.
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}`);
🔦 Context
No response
🖥️ Steps to Reproduce
Run yarn test packages/@react-spectrum/datepicker/test/DatePicker.test.js
from the first Sunday in November to the second Sunday in March.
Version
@react-spectrum/datepicker@3.10.3
What browsers are you seeing the problem on?
Firefox, Chrome, Safari, Microsoft Edge
If other, please specify.
No response
What operating system are you using?
MacOS
🧢 Your Company/Team
Adobe/Accessibility
🕷 Tracking Issue
No response