Closed GoogleCodeExporter closed 9 years ago
I'm looking into this.
Original comment by carlos.m...@gmail.com
on 13 Feb 2010 at 7:04
Hello d.tangren,
I spent some time doing both manual and automatic tests. I was not able to
reproduce
the issue you are describing. Can you please confirm that you tested with
version-0.9, revision 249?
To conduce my investigation, I tried with the following code:
{{{
int testYear = 2010 - 1900;
int month = 5;
calendar.setDate(new Date(testYear, month, 1));
calendar.setView(CalendarViews.MONTH);
calendar.suspendLayout();
for(int day = 1; day < 29; day++)
{
Date testDay = new Date(testYear, month, day);
Appointment apppointment = new Appointment();
apppointment.setTitle(testDay.toString());
apppointment.setStart(testDay);
apppointment.setEnd(testDay);
calendar.addAppointment(apppointment);
Appointment multiDayAppointment = new Appointment();
multiDayAppointment.setStart(new Date(testDay.getYear(),
testDay.getMonth(), testDay.getDate(),0, 0, 0));
multiDayAppointment.setTitle(multiDayAppointment.getStart().toString());
multiDayAppointment.setEnd(new Date(testDay.getYear(),
testDay.getMonth(), testDay.getDate() + 1));
multiDayAppointment.setStyle(Appointment.RED);
calendar.addAppointment(multiDayAppointment);
}
calendar.resumeLayout();
}}}
It configures a simple appointment and a multi-day appointment for each day of
the
month starting on the 1st. and the last being the 28th. I put the 28 limit in
the for
loop to prevent any issues with February. To make things more obvious, I set the
title of all the appointments to be the START date of the same appointment.
To generate configurations for all months, I changed the 'int month = 5;' line
to be
0, 1, etc.
Please let me know if getting the latest revision code solves this issue for
you. If
you have issues after that, I will take another look.
Thank you,
Carlos
Original comment by carlos.m...@gmail.com
on 14 Feb 2010 at 3:37
Hello d.tangren,
I finally figured out the problem. Just by setting one of the appointment's
start
time to be after 00:00:00 makes the problem obvious.
The algorithm to calculate the difference in days between to days was broken
(DateUtils.differenceInDays). Its limited logic could only deal with
Appointments
whose dates represented the FIRST INSTANT of the corresponding day (i.e., 0
hours, 0
minutes, 0 seconds, etc.)
The solution did not have to do with rounding up or down (as I had originally
tried)
but with an 'offset' that has to do with the Daylight saving time and crazy
subtleties related to the way we keep track of time across the world.
Anyway, I hope refreshing your copy of the library to revision 250 will solve
the issue.
After you verify, could you please let me know so I can consider this issue
done?
Best,
Carlos
Original comment by carlos.m...@gmail.com
on 14 Feb 2010 at 8:38
Original comment by Brad.Ryd...@gmail.com
on 12 May 2010 at 7:12
Original issue reported on code.google.com by
d.tang...@gmail.com
on 11 Feb 2010 at 11:16