掲示板

Timezone problem creating "all day" events

thumbnail
9年前 に André Bräkling によって更新されました。

Timezone problem creating "all day" events

Junior Member 投稿: 30 参加年月日: 13/07/08 最新の投稿
Hi everybody,

I become desperate with a very strange issue related to the calendar (running 6.2.10 EE GA1 (Newton / Build 6210 / November 1, 2013)):

I use the default calendar portlet and created my own "upcoming events" portlet which just shows the next three events related to the current shown site. Both, the portal and my user account, are set to UTC+1. Also the server is running in UTC+1/CET/"Europe/Berlin". If I create a new calendar event, e.g., starting at 1 pm and ending at 5 pm, everything works fine. The calendar shows the correct times as well as my own portlet.

But if I create an "all day" event, this happens:

1. The main calender view (right, showing day, week, month or an agenda) shows the event as expected (one day is marked or 00:00 to 23:59 is shown in the agenda view).
2. But: The little monthly overview (top left) marks two days (see attached screenshot - there is no event at the 27th) as taken. Checking the event using my "upcoming events" portlet, it shows "26th 01:00" to "27th 00:59".

So I wonder: Why is the "all day" event shown as expected in the calender view (UTC+1?), but shown one hour late (UTC+2?) in the calender overview (which belongs to the calendar) and my own portlet?

I tried to reproduce the issue on my local machine, but I'm not able to do so. Everything is shown as expected... emoticon

Any help would be appreciated! emoticon

Best regards
André

添付ファイル:

thumbnail
9年前 に Olaf Kock によって更新されました。

RE: Timezone problem creating "all day" events

Liferay Legend 投稿: 6403 参加年月日: 08/09/23 最新の投稿
I didn't follow any calendar issues (e.g. I don't know if this is/was a bug) but here are my thoughts why you can't reproduce in a different environment (check them all):

  • You might be running on a different version (EE Servicepacks don't show in the version information string - check patching-tool for the installed patches.
  • the server might be running on a different timezone, without being configured to do so (E.g. the clock is UTC but Java believes it's CET)
  • Your user profile has a different timezone


There might be more - timezone-debugging is not fun.
thumbnail
9年前 に Juan Gonzalez によって更新されました。

RE: Timezone problem creating "all day" events

Liferay Legend 投稿: 3089 参加年月日: 08/10/28 最新の投稿
HI Andre,

I am aware of two issues about DST and Calendar:

https://issues.liferay.com/browse/LPS-54131

https://issues.liferay.com/browse/LPS-54028

I guess those should fix your issue...
thumbnail
9年前 に Juan Gonzalez によって更新されました。

RE: Timezone problem creating "all day" events

Liferay Legend 投稿: 3089 参加年月日: 08/10/28 最新の投稿
Oooops, I guess my previous answer isn't related to your issue.

AFAIK for avoiding some date inconsistencies, better to startup your server (user.timezone) with GMT. Can you check that?
thumbnail
9年前 に André Bräkling によって更新されました。

RE: Timezone problem creating "all day" events

Junior Member 投稿: 30 参加年月日: 13/07/08 最新の投稿
Juan Gonzalez:
Oooops, I guess my previous answer isn't related to your issue.

AFAIK for avoiding some date inconsistencies, better to startup your server (user.timezone) with GMT. Can you check that?


Thank you very much.

I tried to change all possible timezone settings and combinations - changing the server's system time, the tomcat user.timezone, the Liferay portal timezone and the Liferay user timezone. Only if I change the portal time zone to UTC -1 the all day events are shown correct... but everything else is wrong.

Clarification: The problem is only related to all day events. All events using specific times are shown as expected! Also the calendar view on the right (see screenshot above) shows the correct time (0:00 - 23:59), just the event details and the "mini calendar" on the left don't show the event as expected.

What's the difference between the calendar portlet's right and left side? Why is the agenda shown as expected, but the event details are shown wrong?

It's really strange :/
thumbnail
9年前 に Suresh Nimmakayala によって更新されました。

RE: Timezone problem creating "all day" events

Liferay Master 投稿: 690 参加年月日: 04/08/18 最新の投稿
Hi all,
i have faced same problem in 6.2, however this is not a all day event

for example
Event created on particular day for Mon, March 23, 10:30am - 12:00pm, user and company time zone is UTC +12


* Event shown in Month View fine

* Event shown in left mini calendar on 22nd March
* Event in Agenda funny pick for the day 22nd sunday then event shows on Monday 23rd as Fine, however if you move on to next day by clicking right arrow next to today to select as Monday 23 march but in agenda it disappears

* More funny unable to see the Event in Week View either March 16-22 2015 or March 23-29 2015
*More funny unable to see the Event in Day View


in system-ext.properties i have mentioned user.timezone=Pacific/Auckland

in setenv.sh

i have changed to -Duser.timezone=Pacific/Auckland,


still no luck
is anyone face the same problem, guessing this is the problem exist for 6.2

Regards
Suresh
thumbnail
9年前 に Suresh Nimmakayala によって更新されました。

RE: Timezone problem creating "all day" events

Liferay Master 投稿: 690 参加年月日: 04/08/18 最新の投稿
created a issue
https://issues.liferay.com/browse/LPS-54897
thumbnail
7年前 に Zankar Shah によって更新されました。

RE: Timezone problem creating "all day" events

Regular Member 投稿: 106 参加年月日: 07/10/03 最新の投稿
Hello
Did anyone got answer on this one?

This issue https://issues.liferay.com/browse/LPS-54897 doesnt exist
thumbnail
7年前 に Zankar Shah によって更新されました。

RE: Timezone problem creating "all day" events

Regular Member 投稿: 106 参加年月日: 07/10/03 最新の投稿
Hi
I figure out the issue finally
Changes as follows : CalendarBookingLocalServiceImpl

if (allDay) {
			startTimeJCalendar = JCalendarUtil.toMidnightJCalendar(
					startTime, user.getTimeZone());
			
			System.out.println("1----"+startTimeJCalendar.getTimeInMillis());
			endTimeJCalendar = JCalendarUtil.toLastHourJCalendar(
					endTime, user.getTimeZone());
			System.out.println("2---"+endTimeJCalendar.getTimeInMillis());
		}

Add methods in JCalendarUtil as follows:

public static Calendar toLastHourJCalendar(long time, TimeZone tz) {
		Calendar lastHourJCalendar = Calendar.getInstance(tz);
		lastHourJCalendar.setTimeInMillis(time);
		
		lastHourJCalendar.set(Calendar.HOUR_OF_DAY, 23);
		lastHourJCalendar.set(Calendar.MINUTE, 59);
		lastHourJCalendar.set(Calendar.SECOND, 59);
		lastHourJCalendar.set(Calendar.MILLISECOND, 999);
		
		Calendar gmtcalendar = Calendar.getInstance(_utcTimeZone);
		gmtcalendar.setTimeInMillis(lastHourJCalendar.getTimeInMillis());
		return gmtcalendar;
		
	}

	public static Calendar toMidnightJCalendar(long time, TimeZone tz) {
		Calendar midnightJCalendar = Calendar.getInstance(tz);
		midnightJCalendar.setTimeInMillis(time);
		
		midnightJCalendar.set(Calendar.HOUR_OF_DAY, 0);
		midnightJCalendar.set(Calendar.MINUTE, 0);
		midnightJCalendar.set(Calendar.SECOND, 0);
		midnightJCalendar.set(Calendar.MILLISECOND, 0);
		
		Calendar gmtcalendar = Calendar.getInstance(_utcTimeZone);
		gmtcalendar.setTimeInMillis(midnightJCalendar.getTimeInMillis());
		return gmtcalendar;
	}