owncloud / tasks

:white_check_mark: Tasks app for ownCloud
GNU Affero General Public License v3.0
183 stars 44 forks source link

Time set does not use the same zone. #139

Closed vgezer closed 9 years ago

vgezer commented 9 years ago

With the latest git, if the server time 17:00 GMT+1, and if you set an event with reminder 17:05, it automatically changes itself to 16:05. It seems app does not use the timezone option.

raimund-schluessler commented 9 years ago

Hm, this is strange. With v0.5 this seems to work fine and I didn't (intentionally) change anything related to reminders for master. I will test with master asap.

alfish2000 commented 9 years ago

I've also noticed some problem with a timestamp not being UTC "zulu" time. See my patch at #137 Maybe that time zone problem here is related and the fix needs to be applied at further source code locations.

raimund-schluessler commented 9 years ago

Could you please check that your timezones are set correctly? I can't find an error with how the app handles the reminder.

The reminder date is given as a unix timestamp from the client to the server at https://github.com/owncloud/tasks/blob/master/js/app/services/persistence.coffee#L282. The server then creates a DateTime object from the timestamp at https://github.com/owncloud/tasks/blob/master/controller/taskscontroller.php#L471. When a unix timestamp is given, DateTime ignores the timezone setting, so we get an UTC date (see . http://php.net/manual/en/datetime.construct.php#refsect1-datetime.construct-parameters for reference).

When parsing the date from the reminder on the server, the timezone of the app is set at https://github.com/owncloud/tasks/blob/master/controller/helper.php#L83, so the correct datetime should be shown on the client.

alfish2000 commented 9 years ago

Example: My Client time is 11:22 (this is UTC zulu +1 during winter time with no DST currently) UTC Zulu Time is 10:22

After setting an reminder for 11:25 the database shows: LAST-MODIFIED;VALUE=DATE-TIME:20150301T102209Z TRIGGER;VALUE=DATE-TIME:20150301T102500Z

So the zulu times are correct. Last modified 10:22, tigger for reminder 10:25

My emClient popped up a reminder dialog at 11:25 client time (10:25 zulu time) which is what I expected.

Also when setting a reminder in emClient, the correct time is in the database and in the OC Tasks UI.

So it seems to be fine so far.

But:

1) Mirakel on Android does not show the reminder time at all. (I think this is only a problem of Mirakel. When setting an reminder in Mirakel and sync that to OC, the calendardata does not contain any reminder infos. So maybe that is not implemented in Mirakel at all.)

2) How is the reminder in OC Tasks supposed to work? Should I get an email or something like that? I've added an email address in my settings right now but nothing happened. Maybe my email is not working in general in OC. I've never used any email notification till now so maybe I'm missing some essential OC setup for email notification. But this is not a priority for me at the moment.

raimund-schluessler commented 9 years ago

This is what I would expect. The behaviour on my machine is the same, so no error.

to 1) I can't check what Mirakel does as I don't own an Android device. However, when the calendardata does not contain any reminder after setting one, I would assume a problem in Mirakel

to 2) The task app won't actually remind you yet. It can only be used to set and view the reminder so that other clients like Thunderbird or iOS can remind you. Reminder functionality has to be implemented yet for the app. The best thing here would be a global API for reminders inside OC so that other apps as the calendar could use it too and the reminders are shown globally.

raimund-schluessler commented 9 years ago

@vgezer @alfish2000 Any news on this one? Would like to sort it out before releasing Tasks v0.6.

alfish2000 commented 9 years ago

Currently I don't see any problem with timezones. I made some tests with all my clients:

Mirakel Reminder Test

BEGIN:VCALENDAR VERSION:2.0 PRODID:-//bitfire web engineering//DAVdroid 0.6.7-mirakel (ical4j 2.0.x)//E N BEGIN:VTODO DTSTAMP:20150314T092424Z UID:20150314T092423Z-13765_59c3f37b0b3e310b.ics SUMMARY:Mirakel Reminder Test STATUS:NEEDS-ACTION TRANSP:TRANSPARENT PRIORITY:0 DUE;TZID=Europe/Berlin:20150315T000000 PERCENT-COMPLETE:0 END:VTODO END:VCALENDAR

Note: It seems Mirakel does not support syncing of Reminders

eM Client Reminder Test

BEGIN:VCALENDAR PRODID:-//eM Client/6.0.21372.0 VERSION:2.0 BEGIN:VTIMEZONE TZID:Europe/Berlin X-EM-DISPLAYNAME:(UTC+01:00) Amsterdam\, Berlin\, Bern\, Rom\, Stockholm\, W ien BEGIN:STANDARD TZNAME:Mitteleurop�ische Zeit DTSTART:00010101T030000 TZOFFSETFROM:+0200 TZOFFSETTO:+0100 RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10 END:STANDARD BEGIN:DAYLIGHT TZNAME:Mitteleurop�ische Sommerzeit DTSTART:00010101T020000 TZOFFSETFROM:+0100 TZOFFSETTO:+0200 RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3 END:DAYLIGHT END:VTIMEZONE BEGIN:VTODO UID:fcbfc2fb-a506-45f6-b07d-0ede754c247c DTSTART;TZID="Europe/Berlin":20150316T171700 DUE;TZID="Europe/Berlin":20150316T181800 LAST-MODIFIED:20150314T093420Z DTSTAMP:20150314T093013Z CREATED:20150314T103013Z SUMMARY:eM Client Reminder Test CLASS:PUBLIC CATEGORIES:Fun BEGIN:VALARM ACTION:DISPLAY DESCRIPTION:Alarm X-MOZ-LASTACK:20150316T151500Z ACKNOWLEDGED:20150316T151500Z TRIGGER;RELATED=START:-PT1H1M END:VALARM END:VTODO END:VCALENDAR

Note: It seems that eM Client has some inconsistencies. DTSTAMP:20150314T093013Z CREATED:20150314T103013Z I would expect those timestamps to be equal.

OwnCloud Task Reminder Test

BEGIN:VCALENDAR VERSION:2.0 PRODID:ownCloud Calendar BEGIN:VTODO CREATED;VALUE=DATE-TIME:20150314T094256Z UID:dca41f0727 LAST-MODIFIED;VALUE=DATE-TIME:20150314T094350Z DTSTAMP;VALUE=DATE-TIME:20150314T094350Z SUMMARY:OwnCloud Reminder Test DTSTART;VALUE=DATE-TIME;TZID=Europe/Berlin:20150317T171700 DUE;VALUE=DATE-TIME;TZID=Europe/Berlin:20150318T181800 BEGIN:VALARM ACTION:DISPLAY DESCRIPTION:Default Event Notification TRIGGER;VALUE=DURATION:-PT1H END:VALARM END:VTODO END:VCALENDAR

OwnCould Calendar Reminder Test

BEGIN:VCALENDAR VERSION:2.0 PRODID:ownCloud Calendar BEGIN:VEVENT CREATED;VALUE=DATE-TIME:20150314T101326Z UID:3fe8f7616a LAST-MODIFIED;VALUE=DATE-TIME:20150314T101326Z DTSTAMP;VALUE=DATE-TIME:20150314T101326Z SUMMARY:Cal Reminder Test DTSTART;VALUE=DATE-TIME;TZID=Europe/Berlin:20150314T200000 DTEND;VALUE=DATE-TIME;TZID=Europe/Berlin:20150314T210000 END:VEVENT END:VCALENDAR

Conclusion

The dates/times in OwnCloud Tasks seem to match to the other clients. I'm only asking myself why not always the zulu timestmap format is used by all clients. So in the database would be only normalized timestamps. Each client has to display the date/time according to his timezone anyway.

raimund-schluessler commented 9 years ago

Closing this as it seems to work normal. Please reopen if necessary.