-
Notifications
You must be signed in to change notification settings - Fork 1k
Update Calendar to rely on Date object #6214
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like I am no longer able to change the date on Calendars that don't have onSelect
defined. (See Calendar/First on Sunday and Daylight Savings stories)
Good point -- the docs read that not specifying we should confirm, as a team, if that's the desired behavior. |
Ah okay that makes sense. I think that behavior is reasonable, we should just to be sure to call this out in the release notes since before we weren't enforcing this |
src/js/components/DateInput/__tests__/__snapshots__/DateInput-test.tsx.snap
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice cleanup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks!
What does this PR do?
Previously, Calendar could not handle Daylight Savings Time properly because it relied on ISOstring to infer timezone, however ISOstring only contains information related to UTC offset, but the actual timezone information is lost. See comment for more detail.
This PR refactors Calendar rely on Date object as opposed to ISO strings.
date
anddates
both feed an internal variable calledvalue
. API surface remains the same. All logic considervalue
to be either a Date object, an array of Date objects, a nested array of Date objects, or undefined.Where should the reviewer start?
What testing has been done on this PR?
How should this be manually tested?
Do Jest tests follow these best practices?
screen
is used for querying.userEvent
is used in place offireEvent
.asFragment()
is used for snapshot testing.Any background context you want to provide?
What are the relevant issues?
Closes #6043
Closes #6044
Screenshots (if appropriate)
Do the grommet docs need to be updated?
Should this PR be mentioned in the release notes?
Yes.
Is this change backwards compatible or is it a breaking change?
Backwards compatible + some bug fixes