English (United Kingdom)
English (United States)
7. Suggestions and Feature Requests
(Opens New Window)
Mark as an Answer
December 7, 2012 9:25 AM
Rank: Regular Member
Join Date: March 10, 2009
This post is in regard to http://issues.liferay.com/browse/LPS-27432
Is the root cause of this because com.liferay.portal.kernel.util.CalendarUtil.getGTDate is using returning java.util.Date.getTime() function which does not return the date/time in the same TimeZone that was used when an entry was added to the database? For example, here's what I'm seeing as the main issue:
Assuming JVM is set to use default bundled Liferay setting of using GMT as default timezone.
Assuming the Liferay database CalEvent table's startdate and enddate columns do not store any timezone information.
1. User Bob (with timezone Central Standard Time which is -0600 GMT) enters a timezone-sensitive, recurring Calendar event with start date 2012-12-31 20:00.000 CST and end date 2013-12-31 23:59.000 CST repeating on a daily interval.
1.1. Event is stored in the Liferay Database CalEvent table, with startdate and enddates as "2013-01-01 02:00:00" and "2014-01-01 05:59:59.99", respectively. Note that the recurrence column has a timezone of "America/Chicago" corresponding to user's timezone of CST.
2. User U2 (with timezone CST) views the event.
2.1. Liferay invokes com.liferay.portal.kernel.util.CalendarUitl.getGTDate which returns gtCal.getTime(), which shows the date in the default timezone of GMT.
2.2. The value in "2.1" is passed to java.sql.Timestamp which then has no clue that the the user U2 is in CST and would be interested in seeing this event event. As such, this event is not returned on the day it should be returned for (e.g. 2012-12-31 but rather as part of the following date 2013-01-01).
My suggested solution would be to update the CalendaUtil.getGTDate and similar methods to take into consideration the Calendar's timezone. Or perhaps a wrapper on top of java.sql.Timestamp to do the same (compensate for the timezone difference) before passing the date to the java.sql.Timestamp.
Which solution do you think is best?
Otherwise, since this calendar is being replace by Enterprise Calendar in liferay-plugins, perhaps it's not worth effort to mess with this.
Any comments are appreciated.
Sign in to vote.
Please sign in to flag this as inappropriate.