Commit aba5daa9 authored by Slawek Kaplonski's avatar Slawek Kaplonski Committed by Claudio Cambra
Browse files

Fix 'next week' button in the week's view

When going to the next week in the week's view, it wasn't working
at all if next week was also begining of the next month.
It seems that it was because of the Math.floor() method used to
calculate weekDiff - this method returns always returns integer lower or
equal to the input argument. As calculated value was something like
0.99, Math.floor() returned 0 so there was no change of the week at all.

This patch changes it to use Math.round() which rounds input value to
the closest integer value so it should works better in that case.

Closes-issue: #186
parent d937483f
......@@ -74,7 +74,7 @@ Kirigami.Page {
if(root.daysToShow % 7 === 0) {
date = DateUtils.getFirstDayOfWeek(date);
}
const weekDiff = Math.floor((date.getTime() - pathView.currentItem.startDate.getTime()) / (root.daysToShow * 24 * 60 * 60 * 1000));
const weekDiff = Math.round((date.getTime() - pathView.currentItem.startDate.getTime()) / (root.daysToShow * 24 * 60 * 60 * 1000));
let position = pathView.currentItem.item.hourScrollView.getCurrentPosition();
let newIndex = pathView.currentIndex + weekDiff;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment