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

Always set hours to 0 for periods.getToday #13373

Merged
merged 1 commit into from Aug 31, 2018

Conversation

Projects
None yet
3 participants
@sgiehl
Member

sgiehl commented Aug 31, 2018

fixes #13369

@sgiehl sgiehl added the Needs Review label Aug 31, 2018

@sgiehl sgiehl added this to the 3.7.0 milestone Aug 31, 2018

@@ -348,7 +348,8 @@
// apply piwik site timezone (if it exists)
date.setHours((piwik.timezoneOffset || 0) / 3600);
// get rid of minutes/seconds/etc.
// get rid of hours/minutes/seconds/etc.
date.setHours(0);

This comment has been minimized.

@sgiehl

sgiehl Aug 31, 2018

Member

By default all dates returned for a single day have the time set to 0. But for today the timezone adjustments may end up on the day (before or after) at a specific hour. The current day isn't highlighted for today later, as comparing doesn't match (https://github.com/matomo-org/matomo/blob/3.x-dev/plugins/CoreHome/angularjs/date-picker/date-picker.directive.js#L312-L313) Setting the hour to 0 always should fix that

This comment has been minimized.

@diosmosis

diosmosis Aug 31, 2018

Member

This undoes the setHours() call above, maybe it can be removed? I added it to match the way periods were created server side, but I suppose client side it's just about selecting dates not determining when its needed to aggregate from...

This comment has been minimized.

@sgiehl

sgiehl Aug 31, 2018

Member

Actually it does not really "undo" the setHours. If the timezone offset is negativ the first setHours might move the date to the day before and the setHours(0) will then set the hours to 0 on that day. eg:
image

This comment has been minimized.

@diosmosis

diosmosis Aug 31, 2018

Member

Oh I understand now. Looks good, will merge!

@diosmosis diosmosis merged commit 63e2726 into 3.x-dev Aug 31, 2018

0 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build failed
Details
continuous-integration/travis-ci/push The Travis CI build failed
Details

@diosmosis diosmosis deleted the fixjstoday branch Aug 31, 2018

@mattab mattab modified the milestones: 3.7.0, 3.6.1 Sep 1, 2018

InfinityVoid added a commit to InfinityVoid/matomo that referenced this pull request Oct 11, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment