Some months display incorrectly in List of Events view

Description

When viewing the schedule as "List of events", some months in the Date column are displaying as the next month. For example, if you create a new calendar event for Jun 1, it will display as Jul 1.

The issue is appearing for events created in the following months: Feb, Apr, Jun, Sep, Nov.

To replicate:

  • In 10 or 11 nightly server, go to a site and create a new Schedule event for June 22.

  • Change schedule view to "List of Events" and set filter for month of June.

  • The newly created event will display as Jul 22.

Attachments

2

Activity

Show:

Earle Nietzel April 20, 2017 at 9:39 AM

The fix in uses java 8 new time lib so it will not work for sakai 10 which its language setting is java 7.

Earle Nietzel April 20, 2017 at 9:25 AM

Looks like this issue is incorporated by SAK-31944.

Austin February 3, 2017 at 12:50 PM

The code in 11.x looks the same, so I'd think the patch I mentioned above would work there too (although I have not tested in 11.x yet).

Note that this fix is tricky to test because the problem only happens if you are viewing the calendar when the actual date is near the end of the month e.g. the 31st and the next month is a 30 day or less month. For example, if you had viewed the calendar on Jan 31, you would see February appear as March 03. So when I tested on my local machine as well as our test server, but the actual date was already Feb. 2, I set the system time back to Jan. 31.

Jolie Tingen February 3, 2017 at 8:52 AM

Thanks for this Austin. Would this patch work in 11.x? One of our users just reported this and it would be great to tell them a fix is forthcoming.

Austin February 1, 2017 at 12:12 PM

I believe this problem only happens when you view the "year view" or "list view" when the current day is the 30 or 31st of the month. We ran into this problem yesterday on 1/31, but we don't see it today on 2/1

And it looks like the code that's causing it is in

CalendarUtil.java

This article: http://stackoverflow.com/questions/14605360/a-strange-behavior-from-java-util-calendar-on-february
explains that setting the calendar object's month with calendar.set(f,value) only sets the month but not the day, so later when getTime() is called, it seems as though it uses the current day of the month, so e.g. if the calendar's month is set to February, but current day is Jan 31, when getTime() is called, March 3 is returned.

I'll be patching this in our 10.7 instance with

which sets the day of the month to the 1st so that getTime() returns the correct time.

Fixed

Details

Priority

Affects versions

Fix versions

Components

Assignee

Reporter

Environment

https://qa10-mysql.nightly.sakaiproject.org/ https://qa11-mysql.nightly.sakaiproject.org/

Created May 31, 2016 at 12:42 PM
Updated April 20, 2017 at 10:21 AM
Resolved April 20, 2017 at 10:20 AM