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 date picker shifting day bug #2848

Merged
merged 3 commits into from
Apr 25, 2023
Merged

Fix date picker shifting day bug #2848

merged 3 commits into from
Apr 25, 2023

Conversation

vinibrsl
Copy link
Contributor

This commit fixes a bug where picking a specific date in custom range takes you to the stats of the day before.

This was caused because Flatpickr returns a Date instance, and we were trying to parse this Date instance into day.js using the utc function, assuming it was a ISO-8601 string.

This commit fixes it by casting Date into dayjs using the dayjs function instead of utc.

@vinibrsl vinibrsl requested review from ukutaht and a team April 13, 2023 14:36
@bundlemon
Copy link

bundlemon bot commented Apr 13, 2023

BundleMon

Files updated (1)
Status Path Size Limits
static/js/dashboard.js
298.11KB (+36B +0.01%) -
Unchanged files (6)
Status Path Size Limits
static/css/app.css
492.34KB -
static/js/app.js
12.13KB -
static/js/embed.host.js
5.58KB -
static/js/embed.content.js
5.06KB -
tracker/js/plausible.js
733B -
static/js/applyTheme.js
314B -

Total files change +36B 0%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

assets/js/dashboard/comparison-input.js Outdated Show resolved Hide resolved
This commit fixes a bug where picking a specific date in custom range
takes you to the stats of the day before.

This was caused because Flatpickr returns a Date instance, and we were
trying to parse this Date instance into day.js using the `utc` function,
assuming it was a ISO-8601 string.

This commit fixes it by casting Date into dayjs using the `dayjs`
function instead of `utc`.
This commit fixes a bug where the Flatpickr was not setting the minDate
correctly based on statsBegin. This was failing because parseUTCDate is
now returning a day.js instance, and Flatpickr cannot handle that type.
@vinibrsl vinibrsl merged commit 0cfbced into master Apr 25, 2023
@vinibrsl vinibrsl deleted the flatpickr-dayjs-fix branch April 25, 2023 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants