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

Conversation

majornista
Copy link
Collaborator

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.

Closes #7399

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

Run yarn test packages/@react-spectrum/datepicker/test/DatePicker.test.js from the first Sunday in November to the second Sunday in March, and all tests should pass.

🧢 Your Project:

Adobe/Accessibility

@majornista majornista changed the title fix(#7399): DatePicker.test fails with daylight savings change fix: DatePicker.test fails with daylight savings change #7399 Nov 19, 2024
@majornista majornista changed the title fix: DatePicker.test fails with daylight savings change #7399 fix: DatePicker.test fails with daylight savings change (#7399) Nov 19, 2024
@majornista majornista added bug Something isn't working rsp:DatePicker labels Nov 19, 2024
@rspbot
Copy link

rspbot commented Nov 19, 2024

Copy link
Member

@snowystinger snowystinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting that this will fail even when jest.setSystemTime is in use

out of curiosity, how'd you find this one? it's not failing on main right now and I don't quite follow your comment in the issue description for how to see it.

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.
@majornista
Copy link
Collaborator Author

Interesting that this will fail even when jest.setSystemTime is in use

out of curiosity, how'd you find this one? it's not failing on main right now and I don't quite follow your comment in the issue description for how to see it.

I discovered it when running yarn test locally to make sure I wasn't breaking anything with #7403.

@rspbot
Copy link

rspbot commented Nov 20, 2024

@snowystinger snowystinger added this pull request to the merge queue Nov 20, 2024
Merged via the queue into main with commit 9170093 Nov 20, 2024
30 checks passed
@snowystinger snowystinger deleted the Issue-7399 branch November 20, 2024 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working rsp:DatePicker
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DatePicker.test throws error after deleting a defaultValue in DT/ST when current timeZone is ST/DT
4 participants