6.0.0-beta1
7/5/25

[#12581] Work around inconsistent handling of birthday and anniversary fields in ActiveSync
Summary Work around inconsistent handling of birthday and anniversary fields in ActiveSync
Queue Synchronization
Queue Version Git master
Type Enhancement
State Resolved
Priority 1. Low
Owners mrubinsk (at) horde (dot) org
Requester ryu (at) ryux (dot) org
Created 08/19/2013 (4338 days ago)
Due
Updated 12/30/2013 (4205 days ago)
Assigned 12/24/2013 (4211 days ago)
Resolved 12/30/2013 (4205 days ago)
Milestone
Patch No

History
12/30/2013 09:21:36 PM Michael Rubinsky State ⇒ Resolved
 
12/30/2013 08:44:10 PM marcus (dot) rickert (at) web (dot) de Comment #21 Reply to this comment
Yes ! Exactly.
I just set the timezone of the server to Europe/Paris (I'm from 
France) and the synchronisation is OK in both direction.
It is a pretty workaround for users using Horde in the same timezone.

It works with my ios 4.2.1 perfectly !

Thanks
I can confirm that explicitly setting the date.timezone setting in 
php.ini fixed the time shifting problem for time zone "Europe/Berlin" 
on activesync with iPhone 5 running iOS 7.04 (11B554a). Thanks a lot!
12/28/2013 04:07:23 AM simon (at) simonandkate (dot) net Comment #20 Reply to this comment
The Xperia syncs differently:

31/08/93 syncs as:

2013-12-28T14:03:53+10:00 DEBUG: [11256] I        <POOMCONTACTS:Birthday>
2013-12-28T14:03:53+10:00 DEBUG: [11256] I          1993-08-31T08:00:00.000Z
2013-12-28T14:03:53+10:00 DEBUG: [11256] I        </POOMCONTACTS:Birthday>

So still plus 8 instead of the iPad's minus 10.

But displays correctly in Turba as 31st August.

That then correctly syncs out to iPad as:

2013-12-28T14:04:23+10:00 DEBUG: [11261] O        <POOMCONTACTS:Birthday>
2013-12-28T14:04:23+10:00 DEBUG: [11261] O         1993-08-30T14:00:00.000Z
2013-12-28T14:04:23+10:00 DEBUG: [11261] O        </POOMCONTACTS:Birthday>

Thanks all.
12/28/2013 04:02:16 AM simon (at) simonandkate (dot) net Comment #19 Reply to this comment
OK, my PHP was using UTC, so I set the timezone explicitly in php.ini.

Yes. I am in GMT+10 (Australia).

Now setting a birthday as 27/1/89 on the 7.0.3 iPad syncs as follows:

2013-12-28T13:55:01+10:00 DEBUG: [11326] I        <POOMCONTACTS:Birthday>
2013-12-28T13:55:01+10:00 DEBUG: [11326] I          1989-01-26T14:00:00.000Z
2013-12-28T13:55:01+10:00 DEBUG: [11326] I        </POOMCONTACTS:Birthday>

Turba correctly shows this birthdate as 27th. It is in SQL as 1989-01-27.

This syncs back out to my Zperia Tablet Z (Android 4.3) as:

2013-12-28T14:00:07+10:00 DEBUG: [11327] O        <POOMCONTACTS:Birthday>
2013-12-28T14:00:07+10:00 DEBUG: [11327] O         1989-01-26T14:00:00.000Z
2013-12-28T14:00:07+10:00 DEBUG: [11327] O        </POOMCONTACTS:Birthday>

And correctly displays as 27th January.

So at this stage, all I need to do is check iPad to Horde to iPhone 
and back, but all looking OK for me... :)
12/27/2013 03:06:01 PM ryu (at) ryux (dot) org Comment #18 Reply to this comment

[Show Quoted Text - 10 lines]
Yes ! Exactly.
I just set the timezone of the server to Europe/Paris (I'm from 
France) and the synchronisation is OK in both direction.
It is a pretty workaround for users using Horde in the same timezone.

It works with my ios 4.2.1 perfectly !

Thanks
12/27/2013 02:35:34 PM Michael Rubinsky Comment #17 Reply to this comment
That is then sync'ed to my Android tablet as follows:

2013-12-27T05:15:26+00:00 DEBUG: [24043] O        <POOMCONTACTS:Birthday>
2013-12-27T05:15:26+00:00 DEBUG: [24043] O         2002-04-23T00:00:00.000Z
2013-12-27T05:15:26+00:00 DEBUG: [24043] O        </POOMCONTACTS:Birthday>
This isn't expected based on what I was assuming. It should be sent as 
2002-04-24T08:00:00.000Z.

Can you provide me with some device details? Agent string, android 
version etc... ? Could be the code isn't sniffing out the android 
version properly...or it's an old android version without proper 
support for the field (Android versions < 4).
12/27/2013 02:29:10 PM Michael Rubinsky Comment #16 Reply to this comment
2013-12-27T05:15:20+00:00 DEBUG: [24248] I        <POOMCONTACTS:Birthday>
2013-12-27T05:15:20+00:00 DEBUG: [24248] I          2002-04-23T14:00:00.000Z
2013-12-27T05:15:20+00:00 DEBUG: [24248] I        </POOMCONTACTS:Birthday>
From this I would assume that your iPad is set to UTC+10?
12/27/2013 02:27:05 PM Michael Rubinsky Comment #15 Reply to this comment
I should point out that the only way this is ever going to work is if 
the timezones are the same on the device and the server. This is 
because date values in the EAS protocol are always sent as UTC and 
converted to local timezone on device and server.

iOS  *always* seems to assume the birthday is at midnight, on the 
entered date in the device's local timezone. So, when the record is 
sent to the server, it is adjusted to UTC. The server then re-adjusts 
it back to the server's local timezone. The only way this will 100% 
result in an accurate date is if the timezones are the same.
12/27/2013 02:21:13 PM Michael Rubinsky Comment #14 Reply to this comment
What is the default timezone for php, and what timezone are the 
devices set to?
12/27/2013 05:34:09 AM simon (at) simonandkate (dot) net Comment #13 Reply to this comment
Setting the birthday to correct 24/04 on the Android syncs to server as:

2013-12-27T05:26:09+00:00 DEBUG: [24046] I        <POOMCONTACTS:Birthday>
2013-12-27T05:26:09+00:00 DEBUG: [24046] I          2002-04-24T08:00:00.000Z
2013-12-27T05:26:09+00:00 DEBUG: [24046] I        </POOMCONTACTS:Birthday>

So it syncs at the date + 8 hours (the iPad synced at the date -10 hours).

The server then syncs back to the iPad with:

2013-12-27T05:26:41+00:00 DEBUG: [24043] O        <POOMCONTACTS:Birthday>
2013-12-27T05:26:41+00:00 DEBUG: [24043] O         2002-04-24T00:00:00.000Z
2013-12-27T05:26:41+00:00 DEBUG: [24043] O        </POOMCONTACTS:Birthday>

End result is correct on all devices.

So if I set the date on the Android or the server I get a correct 
result on all devices.

If I edit the contact on the iPad it drops back a day on the server to 
the 23rd, which then syncs to the Android as the 23rd, incorrect.
12/27/2013 05:25:03 AM simon (at) simonandkate (dot) net Comment #12 Reply to this comment
That is then sync'ed to my Android tablet as follows:

2013-12-27T05:15:26+00:00 DEBUG: [24043] O        <POOMCONTACTS:Birthday>
2013-12-27T05:15:26+00:00 DEBUG: [24043] O         2002-04-23T00:00:00.000Z
2013-12-27T05:15:26+00:00 DEBUG: [24043] O        </POOMCONTACTS:Birthday>
12/27/2013 05:21:12 AM simon (at) simonandkate (dot) net Comment #11 Reply to this comment
Just realised that string does not show the iOS version, which is 7.0.3.
12/27/2013 05:19:38 AM simon (at) simonandkate (dot) net Comment #10 Reply to this comment
iPad | Apple-iPad2C2/1102.511Fri, 27 Dec 2013 15:15:21 +1000     
5336108190    Provisioned    APPLDLXFT5X3DFJ2

Birthdate entered on the iPad as 24th April, synced to server as 23rd.


2013-12-27T05:15:20+00:00 INFO: [24248] Loading state for synckey 
{52bd0b3c-e9b4-4551-b98e-5deec0a801e6}17
2013-12-27T05:15:20+00:00 DEBUG: [24248] I      <Modify>
2013-12-27T05:15:20+00:00 DEBUG: [24248] I       <ServerEntryId>
2013-12-27T05:15:20+00:00 DEBUG: [24248] I         [60 bytes of content]
2013-12-27T05:15:20+00:00 DEBUG: [24248] I       </ServerEntryId>
2013-12-27T05:15:20+00:00 DEBUG: [24248] I       <Data>
2013-12-27T05:15:20+00:00 DEBUG: [24248] I        <AirSyncBase:Body>
2013-12-27T05:15:20+00:00 DEBUG: [24248] I         <AirSyncBase:Type>
2013-12-27T05:15:20+00:00 DEBUG: [24248] I           1
2013-12-27T05:15:20+00:00 DEBUG: [24248] I         </AirSyncBase:Type>
2013-12-27T05:15:20+00:00 DEBUG: [24248] I         <AirSyncBase:Data />
2013-12-27T05:15:20+00:00 DEBUG: [24248] I        </AirSyncBase:Body>
2013-12-27T05:15:20+00:00 DEBUG: [24248] I        <POOMCONTACTS:Birthday>
2013-12-27T05:15:20+00:00 DEBUG: [24248] I          2002-04-23T14:00:00.000Z
2013-12-27T05:15:20+00:00 DEBUG: [24248] I        </POOMCONTACTS:Birthday>
2013-12-27T05:15:20+00:00 DEBUG: [24248] I        <POOMCONTACTS:Email1Address>
2013-12-27T05:15:20+00:00 DEBUG: [24248] I          **********************
2013-12-27T05:15:20+00:00 DEBUG: [24248] I         
</POOMCONTACTS:Email1Address>
2013-12-27T05:15:20+00:00 DEBUG: [24248] I        <POOMCONTACTS:Email2Address>
2013-12-27T05:15:20+00:00 DEBUG: [24248] I          **********************
2013-12-27T05:15:20+00:00 DEBUG: [24248] I         
</POOMCONTACTS:Email2Address>
2013-12-27T05:15:20+00:00 DEBUG: [24248] I        <POOMCONTACTS:FileAs>
2013-12-27T05:15:20+00:00 DEBUG: [24248] I          **********************
2013-12-27T05:15:20+00:00 DEBUG: [24248] I        </POOMCONTACTS:FileAs>
2013-12-27T05:15:20+00:00 DEBUG: [24248] I        <POOMCONTACTS:FirstName>
2013-12-27T05:15:20+00:00 DEBUG: [24248] I          ********
2013-12-27T05:15:20+00:00 DEBUG: [24248] I        </POOMCONTACTS:FirstName>
2013-12-27T05:15:20+00:00 DEBUG: [24248] I        <POOMCONTACTS:LastName>
2013-12-27T05:15:20+00:00 DEBUG: [24248] I          Wilson
2013-12-27T05:15:20+00:00 DEBUG: [24248] I        </POOMCONTACTS:LastName>
2013-12-27T05:15:20+00:00 DEBUG: [24248] I        <POOMCONTACTS:Picture />
2013-12-27T05:15:20+00:00 DEBUG: [24248] I        <POOMCONTACTS:Categories>
2013-12-27T05:15:20+00:00 DEBUG: [24248] I         <POOMCONTACTS:Category>
2013-12-27T05:15:20+00:00 DEBUG: [24248] I           Family
2013-12-27T05:15:20+00:00 DEBUG: [24248] I         </POOMCONTACTS:Category>
2013-12-27T05:15:20+00:00 DEBUG: [24248] I        </POOMCONTACTS:Categories>
2013-12-27T05:15:20+00:00 DEBUG: [24248] I       </Data>
2013-12-27T05:15:20+00:00 INFO: [24248] 
Horde_Core_ActiveSync_Driver::_smartStatMessage(@Contacts@, 
20130503091539.Xx-bLJ7JaWUR7JoAyciBRA4@mail.simonandkate.net)
2013-12-27T05:15:20+00:00 INFO: [24248] 
Horde_Core_ActiveSync_Driver::changeMessage(@Contacts@, 
20130503091539.Xx-bLJ7JaWUR7JoAyciBRA4@mail.simonandkate.net ...)
2013-12-27T05:15:20+00:00 INFO: [24248] 
Horde_Core_ActiveSync_Driver::_smartStatMessage(@Contacts@, 
20130503091539.Xx-bLJ7JaWUR7JoAyciBRA4@mail.simonandkate.net)
2013-12-27T05:15:20+00:00 INFO: [24248] Updating state during change
12/24/2013 04:34:17 PM Michael Rubinsky Comment #9
State ⇒ Assigned
Reply to this comment
Though now that I think about it some more, it might make more sense 
to treat the incoming birthday field the same anyway... it's far more 
likely that we are not actually entering/changing the birthday on the 
device, but rather it is being sent as part of another edit (even 
though it shouldn't be, but that's a completely different story).

I'll look at this some more when I'm back in my office.
12/24/2013 04:31:15 PM Michael Rubinsky Summary ⇒ Work around inconsistent handling of birthday and anniversary fields in ActiveSync
State ⇒ Resolved
Assigned to Michael Rubinsky
 
12/24/2013 04:30:06 PM Michael Rubinsky Comment #8 Reply to this comment
Sorry... Bad news. it does not work with my old iPhone on ios 4.2.1
It is impossible to fix this correctly in iOS < 5. The fix will only 
be accurate in later versions. Earlier versions do not use any 
consistency in the time the birthday is represented as. When the 
birthday is entered/changed on the device it uses the current time of 
day. No idea what time it expects it as when the birthday is 
transmitted to the device. My guess is it ignores the time entirely 
and does not perform any UTC -> timezone translation.
12/24/2013 02:04:12 PM ryu (at) ryux (dot) org Comment #7
New Attachment: syncLog.txt Download
Reply to this comment
Michael Rubinsky: FYI, I have added code to Horde_ActiveSync to 
attempt to work around this bug. It relies on sniffing out the 
client in use and adjusting the birthday accordingly. So, if it is 
still not working for anyone, please provide the device information 
(from the activesync properties screen) and the log showing the 
contact being synched.
Sorry... Bad news. it does not work with my old iPhone on ios 4.2.1

Device Information
Id: Appl888298T71R4
Clef d'accès: 0
User Agent: Apple-iPhone1C2/803.148
EAS Version: 14.0

And the sync log in attachment

The birthday is 06/05/1981 (6th of may 1981). I leave in France if 
this is important for the time zone.

I did not check with a newer device with ios 7...

Ryu

12/18/2013 04:56:22 PM ryu (at) ryux (dot) org Comment #6 Reply to this comment
Michael Rubinsky: FYI, I have added code to Horde_ActiveSync to 
attempt to work around this bug. It relies on sniffing out the 
client in use and adjusting the birthday accordingly. So, if it is 
still not working for anyone, please provide the device information 
(from the activesync properties screen) and the log showing the 
contact being synched.
Ok, good news ! I check this improvement asap and I tell you. Thx
12/17/2013 08:27:03 AM Jan Schneider Comment #5 Reply to this comment
Michael Rubinsky: FYI, I have added code to Horde_ActiveSync to 
attempt to work around this bug. It relies on sniffing out the client 
in use and adjusting the birthday accordingly. So, if it is still not 
working for anyone, please provide the device information (from the 
activesync properties screen) and the log showing the contact being 
synched.
11/28/2013 02:41:43 PM ryu (at) ryux (dot) org Comment #4 Reply to this comment
We're not going down the path of selectively ignoring client sent 
fields that should be supported by the protocol.
I find your answer a bit hard. I understand that this is not the right 
solution. But sometimes you have to be flexible to make users happy ...
AS is a bad protocol for dates, but if you can work around, that's fine. No?
11/23/2013 06:27:07 PM Michael Rubinsky Comment #3
State ⇒ Rejected
Reply to this comment
We're not going down the path of selectively ignoring client sent 
fields that should be supported by the protocol.
08/27/2013 07:13:55 AM simon (at) simonandkate (dot) net Comment #2 Reply to this comment
This issue remains the single biggest bugbear for my users... sad I know. :)

You should try it when you have multiple AS devices on the same 
account, I have had instances of birthdays shifting up to 5 or 6 days 
out :-O

A workaround or fix of some description for this would make my year.   
Although blocking it sounds like a last resort! :)
08/19/2013 10:08:05 AM ryu (at) ryux (dot) org Comment #1
Priority ⇒ 1. Low
Type ⇒ Enhancement
Summary ⇒ Block client update for bithday field
Queue ⇒ Synchronization
Milestone ⇒
Patch ⇒ No
State ⇒ New
Reply to this comment
Hi,

I know this is a known issue with most ActiveSync clients, but the 
birtday offset issue is very annoying...

It would be useful to have an option to block the update from the clients.

The communication would be only from Server => Client and not from 
Client => Server for this (a list?) field.

I'm aware it is a ... bad fix, but I try to please all my users.

If not, is there another workaround to do this ?

Ryu

Saved Queries