-
Notifications
You must be signed in to change notification settings - Fork 169
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: DateRange - startdate flicker to epoch0, auto enddate decrease and larger range selection #1893
base: next
Are you sure you want to change the base?
Conversation
…nd larger range selection
🦋 Changeset detectedLatest commit: 9ba8e2b The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for evidence-development-workspace ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for next-docs-evidence ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Can you add a test case to the |
@archiewood Date Error (solved by modifying Infinite reactive call & limited date range error - (Screencast after solving date error) After: |
9d616df
to
1be7961
Compare
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.
Thanks for the PR @AyushAgrawal-A2!
A couple notes here and one requested change (template string needs to be made easier to read)
packages/ui/core-components/src/lib/atoms/inputs/date-range/DateRange.svelte
Outdated
Show resolved
Hide resolved
start: selectedDateRange.start?.toString() ?? dateToYYYYMMDD(new Date(0)), | ||
end: selectedDateRange.end?.toString() ?? dateToYYYYMMDD(new Date()) |
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.
Does this change cause a loss of timezone information?
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.
@ItsMeBrianD
Actually 'selectedDateRange' object has start and end fields, both of which are CalenderDate
objects.
As the user is directly selecting a date, timezone is not required. We need just the selected date. Converting to Date
object can lead to internationalization issues. This is recommended in their docs:
https://react-spectrum.adobe.com/internationalized/date/CalendarDate.html#conversion
Luckily the toString
method give the date string directly in required format. We can just skip the conversion to Date object and then to string in dateToYYYYMMDD
fn.
Description
closes #1875
closes #1892
Problems Identified:
query
depends ondata
which depends on$input[name].(start & end)
which depends onstartString
&endString
which depends back onquery
.$query
is required to be run once to get date range for available data, but here it is getting triggered repeatedly due to reactive dependencies. When$query
was being refetched startString null coalesce to epoch0 and endString null coalesce to todays date.selectedDateRange
changes$input[name].(start & end)
which changesstartString
&endString
due to above mentioned infinite call. This disables dates outside current selection.dateToYYYYMMDD
function usedDate.toISOString()
method, which has date in UTC format. This results in previous date for some locale. This combined with infinite call bug, was repeatedly decrementing end date.Checklist