-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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(analytics): remove zero values being added in charts #7425
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.
nice! love the tests. two quick questions and then let's move this forward
final DateTime now = DateTime.now(); | ||
final DateTime aWeekAgo = now.minusWeeks(1); | ||
final DateTime endOfWeek = DateTime.now() | ||
.plusDays(1) |
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.
I assume you add plusDays(1)
here in case today is Sunday and we need to get the following sunday? and this is all good if today is Saturday?
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.
What I wanted was the exact end of Sunday. I initially tried that by setting things as 23:59:59.999 but the rendering on the frontend added one point with zero for the exact end. So decided to make it the exact beginning of next Monday by adding plus 1 days.
@@ -25,7 +25,7 @@ type Props = { | |||
const MARGIN_SIZE = 40; | |||
|
|||
function insertBlankAt(ts: number, newLine: Array<NumericDataPoint>) { | |||
const dateString = new Date(ts).toString(); | |||
const dateString = new Date(ts).toISOString(); |
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.
why this change here?
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.
For the tests basically. Otherwise it would contain people's timezone in the string and it become impossible to test this out for everyone.
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.
Okay for now. Let's keep an eye on this obviously
it('add date interval works correctly', () => { | ||
const input = new Date(1677242304000); | ||
const afterAdd = addInterval(1, input, DateInterval.Month); | ||
const expected = new Date(1679661504000); |
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.
This is failing for me because the result is an hour off in my timezone, I think because the next month in my timezone is an hour shorter due to daylight savings? The result I get is 1679657904000. Is the addInterval function calculating the interval in GMT time?
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.
#7484 Will see if we can reliably reproduce the failure in CI. Then we will work on fixing it. This should have been caught in the CI
Checklist