google-code-export / gwt-cal

Automatically exported from code.google.com/p/gwt-cal
1 stars 0 forks source link

Wrong display of appointments in month view #40

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Calendar calendar = new Calendar();
2.1. calendar.addAppointment(appt);
2.2. calendar.addAppointment(appt);
..............
2.xxx. calendar.addAppointment(appt);
3. calendar.setView(CalendarViews.MONTH);

What is the expected output? What do you see instead?
In month view I expect to see all appointment for the month. Appointments
have to be placed in the good day of the month.

Instead we can see that for some days in the month, we have appointments
from last month (for exemple, in the 3 december panel, I can find
appointments from 26 november.

I find the problem : 
It's because in MonthLayoutDescription in the method calculateWeekFor, we
calculate the difference in week between testDate and calendarFirstDate...
but the code don't care about negative or positive difference. So for my
exemple, there is 4 days difference between 30 november (first day in
month) and 26 november. And appointments for 26 november are diplay in the
4th day in the first week!

So I do this stuff in MonthLayoutDescription class to resolve the problem: 

private int calculateWeekFor(Date testDate, Date calendarFirstDate) {
        /*this test to get out every dates before calendarFirstDate*/
        if (testDate.before(calendarFirstDate)){
            return -1;
        }
        int endWeek = (int) Math
            .floor(DateUtils.differenceInDays(testDate, calendarFirstDate) /
                7d);
        return Math.min(endWeek, weeks.length - 1);
    }

What version of the product are you using? On what operating system?
Latest from repository

Please provide any additional information below.

I hope that it can be usefull for you! Thank you for this API, it's perfect
for me, and... very good job!

Best regards!

Zinou

Original issue reported on code.google.com by kevinher...@gmail.com on 25 Mar 2010 at 2:20

GoogleCodeExporter commented 9 years ago

Original comment by Brad.Ryd...@gmail.com on 30 Mar 2010 at 12:52

GoogleCodeExporter commented 9 years ago
Marking as critical - i'd like to resolve prior to 0.9 final version

Original comment by Brad.Ryd...@gmail.com on 21 Apr 2010 at 8:50

GoogleCodeExporter commented 9 years ago
I have started working on this issue. I am planning to have a fix by May 2nd, 
2010. 

Original comment by carlos.m...@gmail.com on 29 Apr 2010 at 3:46

GoogleCodeExporter commented 9 years ago
This item has been fixed and uploaded to trunk

Original comment by Brad.Ryd...@gmail.com on 12 May 2010 at 3:08