From 0dea50eeaca0a5fbbb44f120d76039e02cad8d44 Mon Sep 17 00:00:00 2001 From: Jesse Hoobergs Date: Sat, 9 Sep 2017 15:12:44 +0200 Subject: [PATCH] Fix daysBetween see #49 --- .../src/main/java/com/alamkanak/weekview/WeekViewUtil.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/library/src/main/java/com/alamkanak/weekview/WeekViewUtil.java b/library/src/main/java/com/alamkanak/weekview/WeekViewUtil.java index 1b6c7c34a..e7e63baad 100644 --- a/library/src/main/java/com/alamkanak/weekview/WeekViewUtil.java +++ b/library/src/main/java/com/alamkanak/weekview/WeekViewUtil.java @@ -62,10 +62,8 @@ public static boolean isSameDayAndHour(Calendar dateOne, Calendar dateTwo) { * @return the amount of days between dateTwo and dateOne */ public static int daysBetween(Calendar dateOne, Calendar dateTwo) { - return (int) ( - (dateTwo.getTimeInMillis() + dateTwo.getTimeZone().getOffset(dateTwo.getTimeInMillis()) - - (dateOne.getTimeInMillis() + dateOne.getTimeZone().getOffset(dateOne.getTimeInMillis()))) - / (1000 * 60 * 60 * 24f)); + return (int) (((dateTwo.getTimeInMillis() + dateTwo.getTimeZone().getOffset(dateTwo.getTimeInMillis())) / (1000 * 60 * 60 * 24)) - + ((dateOne.getTimeInMillis() + dateOne.getTimeZone().getOffset(dateOne.getTimeInMillis())) / (1000 * 60 * 60 * 24))); } /*