View Issue Details

IDProjectCategoryView StatusLast Update
0003579SOGoWeb Address Bookpublic2016-04-05 22:07
Reportertfu Assigned Toludovic  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Platform[Client] MicrosoftOSWindowsOS Version7
Product Version3.0.2 
Fixed in Version3.1.0 
Summary0003579: Birthday is saved 1 day in the past into the vcard
Description

01-jan-2003 is saved as BDAY:20021231. The WebUI shows this as 01-jan-2003.
This date is just an example, the problem can reproduced also with other dates.
This can be reproduced on http://demo.sogo.nu/SOGo.

Steps To Reproduce

Create a new contact and set the birthday to 01-jan-2003. The contact's vcard look like this:

BEGIN:VCARD
UID:4F21-56E3DA80-31-52C8E000.vcf
VERSION:3.0
CLASS:PUBLIC
PROFILE:VCARD
N:a;a
BDAY:20021231
END:VCARD

TagsNo tags attached.

Activities

tfu

tfu

2016-03-12 10:04

reporter   ~0009731

http://demo.sogo.nu/SOGo seems to be currently on version 3.0.1 (according to what is shown in preferences).

tfu

tfu

2016-03-12 10:48

reporter   ~0009732

On my env I can reproduce the problem if I set the birthday to a date between e.g. 25-sep-83 and 30-oct-83 or 30-sep-05 and 27-oct-85. Dates between these sample dates results in a BDAY one day earlier.

User's timezone: Europe/London

tfu

tfu

2016-03-13 10:33

reporter   ~0009735

The reproducibility of the problem depends the timezone setting of.

e.g.:
SOGoTimeZone=Europe/Vienna
User Prefernces=Europe/Vienna
Browser/Client=Europe/Vienna

Setting the birthday to 2016-03-13:
The browser returns an integer which is converted in UIxContactEditor.m->setAttributes:

date = [NSCalendarDate dateWithTimeIntervalSince1970: seconds];

to this date: 2016-03-13 00:00:00 +0100

The resulting value for BDAY is 20160313. -> OK

Setting the birthday to 1985-10-26:
The browser returns an integer which is converted in UIxContactEditor.m->setAttributes:

date = [NSCalendarDate dateWithTimeIntervalSince1970: seconds];

to this date: 1985-10-25 23:00:00 +0100

The resulting value for BDAY is 19851025. -> Wrong

I hope this finding helps to fix the problem.

==

Another timezone related issue might be in NGVCard+SOGo.m->birthday:

I think to have consistent results this should be changed from

  date = [NSCalendarDate dateFromShortDateString: value
                              andShortTimeString: nil
                                      inTimeZone: nil];

to

  date = [NSCalendarDate dateFromShortDateString: value
                              andShortTimeString: nil
                                      inTimeZone: [NSTimeZone timeZoneWithName: @"GMT"]];

This should give a consistent result which is not influenced by set setting in SOGoTimeZone.

Related Changesets

sogo: master 85cacd97

2016-03-13 13:44:42

ludovic

Details Diff
Use GMT tz when setting birthday (fixes 0003579) Affected Issues
0003579
mod - SoObjects/Contacts/NGVCard+SOGo.m Diff File

sogo: v2 20b1d3c0

2016-03-13 13:44:42

ludovic

Details Diff
Use GMT tz when setting birthday (fixes 0003579) Affected Issues
0003579
mod - SoObjects/Contacts/NGVCard+SOGo.m Diff File

sogo: master bfd69d3f

2016-04-05 22:03:52

francis

Details Diff
Improve handling of a contact's birthday

Fixes 0003579
Affected Issues
0003579
mod - UI/Contacts/UIxContactEditor.m Diff File
mod - UI/Contacts/UIxContactView.m Diff File
mod - UI/WebServerResources/js/Contacts/Card.service.js Diff File

Issue History

Date Modified Username Field Change
2016-03-12 04:06 tfu New Issue
2016-03-12 10:04 tfu Note Added: 0009731
2016-03-12 10:48 tfu Note Added: 0009732
2016-03-13 10:33 tfu Note Added: 0009735
2016-03-13 13:45 ludovic Changeset attached => sogo master 85cacd97
2016-03-13 13:45 ludovic Assigned To => ludovic
2016-03-13 13:45 ludovic Resolution open => fixed
2016-03-13 13:47 ludovic Changeset attached => sogo v2 20b1d3c0
2016-03-13 13:48 ludovic Status new => resolved
2016-03-13 13:48 ludovic Fixed in Version => 3.1.0
2016-04-05 22:07 francis Changeset attached => sogo master bfd69d3f