[kronolith] Kronolith - Birthdays off by one day [SOLVED]
Volker Then
horde40 at volkerthen.com
Mon Oct 6 20:28:18 UTC 2014
Zitat von Michael J Rubinsky <mrubinsk at horde.org>:
> Quoting Michael J Rubinsky <mrubinsk at horde.org>:
>
>> Quoting Volker Then <horde40 at volkerthen.com>:
>>
>>> Zitat von Michael J Rubinsky <mrubinsk at horde.org>:
>>>
>>>> Quoting John H. Bennett III <bennettj at thebennetthome.com>:
>>>>
>>>>> Quoting Michael J Rubinsky <mrubinsk at horde.org>:
>>>>>
>>>>>> Quoting Volker Then <horde40 at volkerthen.com>:
>>>>>>
>>>>>>> Zitat von "John H. Bennett III" <bennettj at thebennetthome.com>:
>>>>>>>
>>>>>>>> Quoting Michael J Rubinsky <mrubinsk at horde.org>:
>>>>>>>>
>>>>>>>>> Quoting Volker Then <horde40 at volkerthen.com>:
>>>>>>>>>
>>>>>>>>>> Zitat von "John H. Bennett III" <bennettj at thebennetthome.com>:
>>>>>>>>>>
>>>>>>>>>>> Quoting Michael J Rubinsky <mrubinsk at horde.org>:
>>>>>>>>>>>
>>>>>>>>>>>> Quoting John H. Bennett III <bennettj at thebennetthome.com>:
>>>>>>>>>>>>
>>>>>>>>>>>>> Quoting Michael J Rubinsky <mrubinsk at horde.org>:
>>>>>>>>>>>>>
>>>>>>>>>>>>>> Quoting Volker Then <horde40 at volkerthen.com>:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Zitat von Michael J Rubinsky <mrubinsk at horde.org>:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Quoting Michael J Rubinsky <mrubinsk at horde.org>:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Quoting John H. Bennett III <bennettj at thebennetthome.com>:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Quoting Michael J Rubinsky <mrubinsk at horde.org>:
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> Quoting John H. Bennett III <bennettj at thebennetthome.com>:
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>> Quoting Simon Wilson <simon at simonandkate.net>:
>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> Hello,
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> I've stumbled across a problem that I don't
>>>>>>>>>>>>>>>>>>>>>> know what's going on.
>>>>>>>>>>>>>>>>>>>>>> I've added birthdays to some of my contacts, I
>>>>>>>>>>>>>>>>>>>>>> put them in with the
>>>>>>>>>>>>>>>>>>>>>> correct date, but some time in the future, I
>>>>>>>>>>>>>>>>>>>>>> look at them on the
>>>>>>>>>>>>>>>>>>>>>> Calendar, and some show a day off (ahead one
>>>>>>>>>>>>>>>>>>>>>> day). I edit them in
>>>>>>>>>>>>>>>>>>>>>> turba again, and again some time in the future
>>>>>>>>>>>>>>>>>>>>>> some are off a day.
>>>>>>>>>>>>>>>>>>>>>> This has happened 4 times in the last 2 weeks.
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> I don't know what's triggering this. Anyone
>>>>>>>>>>>>>>>>>>>>>> else seeing this? What
>>>>>>>>>>>>>>>>>>>>>> can I look for to help try to explain this.
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> Thanks,
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> John
>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>> There has been discussion on this in the past on
>>>>>>>>>>>>>>>>>>>>> the list... mostly around birthdays syncing
>>>>>>>>>>>>>>>>>>>>> incorrectly through ActiveSync and back.
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> If this is due to ActiveSync, it should only
>>>>>>>>>>>>>>>>>>> affect the contacts that have been edited on the
>>>>>>>>>>>>>>>>>>> client. Is that what you are seeing?
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>>>>>> mike
>>>>>>>>>>>>>>>>>>> The Horde Project
>>>>>>>>>>>>>>>>>>> http://www.horde.org
>>>>>>>>>>>>>>>>>>> https://www.facebook.com/hordeproject
>>>>>>>>>>>>>>>>>>> https://www.twitter.com/hordeproject
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Hi Mike,
>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>> Yes, that is what I am seeing. I made a change to
>>>>>>>>>>>>>>>>>> my contact info on my Note 3,
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Can you tell me what Android version you are using on
>>>>>>>>>>>>>>>> the Note? Did you take the KK update?
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Here it is only with contacts that are edited on the
>>>>>>>>>>>>>>> client - and that happens (almost) every time the
>>>>>>>>>>>>>>> contact has been edited. Some of the birthdays shifted
>>>>>>>>>>>>>>> minus four days after a few edits. Nexus 5, Kitkat
>>>>>>>>>>>>>>> 4.4.4, Nine.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Can you test if this commit:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> https://github.com/horde/horde/compare/46ff2bea431aa99d82afc33d19cfb5cd23be90a4...b8a48c13b550d70754a9b3585912762683ff1ddc
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> fixes it for you?
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> --
>>>>>>>>>>>>>
>>>>>>>>>>>>> Hi Mike,
>>>>>>>>>>>>>
>>>>>>>>>>>>> That didn't fix it. The date still shows up one day earlier.
>>>>>>>>>>>>>
>>>>>>>>>>>>> I created 2 contacts with different birthdays. Edited
>>>>>>>>>>>>> one from my device, and one from turba, then did a sync.
>>>>>>>>>>>>> Contact edited on device, shows birthday one day early.
>>>>>>>>>>>>> Contact from turba, fine. Then did the opposite, and
>>>>>>>>>>>>> original contact edited from turba now shows birthday
>>>>>>>>>>>>> one day early.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Please let me know if you want to to try anything else.
>>>>>>>>>>>>
>>>>>>>>>>>> What timezone are you in? I want to set up my environment
>>>>>>>>>>>> the same as yours so I can trace this.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>> mike
>>>>>>>>>>>> The Horde Project
>>>>>>>>>>>> http://www.horde.org
>>>>>>>>>>>> https://www.facebook.com/hordeproject
>>>>>>>>>>>> https://www.twitter.com/hordeproject
>>>>>>>>>>>
>>>>>>>>>>> I am in the Central Time Zone.
>>>>>>>>>>>
>>>>>>>>>>> from php.ini - date.timezone = "America/Chicago", horde
>>>>>>>>>>> prefs set to America/Chicago also.
>>>>>>>>>>>
>>>>>>>>>>> John
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> The commit didn't work for me either. I am in CEST. Horde
>>>>>>>>>> prefs set to Europe/Berlin.
>>>>>>>>>
>>>>>>>>> Ok. How about the lastest Git?
>>>>>>>>>
>>>>>>>>>
>>>>>>>> Still didn't work for me with my note3.
>>>>>>>>
>>>>>>>> I used the raw file from this link,
>>>>>>>> https://github.com/horde/horde/blob/master/framework/ActiveSync/lib/Horde/ActiveSync/Device.php
>>>>>>>>
>>>>>>>> John
>>>>>>>
>>>>>>> Same here.
>>>>>>
>>>>>> I reread the Android source code for the contacts sync provider
>>>>>> and revamped some code in Horde. The current code (already
>>>>>> released in PEAR) works for me on my various test devices, and
>>>>>> all the tests pass. If it doesn't work for you at this point,
>>>>>> I'm really not sure what else to tell you other than you will
>>>>>> need to trace the code to see where the date is being shifted.
>>>>>>
>>>>>
>>>>> Still doesn't work for me. I turned on per device logging and
>>>>> have a log I can send to you personally, if that is OK?
>>>>
>>>> Sure, you can send it to me though I can't promise any miracles
>>>> since I can't reproduce.
>>>>
>>>
>>> Hi Mike,
>>> after all this seems not be an Android issue. I checked it now
>>> with my iOS test device (iPhone 4 iOS 7.1.2). After editing a
>>> contact on the client side (where the correct birthday was shown)
>>> the birthday shifts minus one day on the server side.
>>> I can't figure out what might be the time zone problem, if there
>>> is any, since all devices use time zone Europe/Berlin (iOS,
>>> Android, Horde prefs, server time: Mon Oct 6 15:40:40 CEST 2014).
>>>
>>> A birthday syncs to the phone like this:
>>>
>>> 2014-10-06T13:55:37+00:00 DEBUG: [26223] O <POOMCONTACTS:Birthday>
>>> 2014-10-06T13:55:37+00:00 DEBUG: [26223] O 1966-07-23T00:00:00.000Z
>>> 2014-10-06T13:55:37+00:00 DEBUG: [26223] O </POOMCONTACTS:Birthday>
>>>
>>> And after editing on the phone it goes back to the server like this:
>>> 2014-10-06T13:57:23+00:00 DEBUG: [26223] I <POOMCONTACTS:Birthday>
>>> 2014-10-06T13:57:23+00:00 DEBUG: [26223] I
>>> 1966-07-22T23:00:00.000Z
>>> 2014-10-06T13:57:23+00:00 DEBUG: [26223] I </POOMCONTACTS:Birthday>
>>>
>>> I wonder if this shifting has some something to do with daylight savings...
>>
>> You are correct in that the offset sent from the device is due to
>> DST, however this is exactly what is expected for an iOS device
>> running iOS 5 or greater. In code, the datetime is converted back
>> to to the user's date_default_timezone - which moves it back to the
>> correct day. I've added another test to the test suite for this,
>> and it passes for me. The only way I see this not working is if one
>> of the timezones in use is actually NOT Europe/Berlin. Otherwise,
>> you will need to trace the code to see where the conversion is
>> failing for you.
>>
>> Essentially, in your case
>> Horde_ActiveSync_Device::normalizePoomContactsDates() should return
>> a Horde_Date object that contains the UTC version of the datetime
>> (1966-07-23 23:00:00). So, this means that in
>> Turba_Driver::fromASContact() $message-birthday should be the UTC
>> time as well. We then change the timezone in a clone of that object
>> to the local timezone and format it as Y-m-d. This should move the
>> datetime back to the correct date in Turba.
>
> Actually, on second thought the offset looks incorrect for DST in
> Europe/Berlin. If I'm not mistaken, that should be a UTC+2 offset,
> right? So it's off by one hour. Regardless, the server side will
> still shift the date *ahead* in your timezone, so even if the offset
> is off by an hour, the resulting Y-m-d value will still be the
> correct value.
OK, this is solved, my fault. I was quite sure that the PHP timezone
settings were correct, but they weren't! I set this to
date.timezone= "Europe/Berlin"
and the shifting is gone (as was already discussed on the list, as I
remember). Mike, sorry for your inconvenience and the unnecessary
tests you did!
John, please check your php.ini settings as well, thanks!
Volker
More information about the kronolith
mailing list