diff --git a/NEWS b/NEWS index adfa28f64..20a6ba973 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,7 @@ Enhancements - updated Czech translation + - birthday is now properly formatted in addressbook module Bug fixes - fixed handling of groups with spaces in their UID diff --git a/UI/Contacts/UIxContactView.m b/UI/Contacts/UIxContactView.m index 1c0e55dd6..392aabdaf 100644 --- a/UI/Contacts/UIxContactView.m +++ b/UI/Contacts/UIxContactView.m @@ -30,6 +30,9 @@ #import #import +#import +#import +#import #import #import "UIxContactView.h" @@ -612,7 +615,23 @@ - (NSString *) bday { - return [self _cardStringWithLabel: @"Birthday:" value: [card bday]]; + NSString *bday, *value; + NSCalendarDate *date; + SOGoDateFormatter *dateFormatter; + + bday = [card bday]; + if (bday) + { + // Expected format of BDAY is YYYY[-]MM[-]DD + value = [bday stringByReplacingString: @"-" withString: @""]; + date = [NSCalendarDate dateFromShortDateString: value + andShortTimeString: nil + inTimeZone: nil]; + dateFormatter = [[[self context] activeUser] dateFormatterInContext: context]; + bday = [dateFormatter formattedDate: date]; + } + + return [self _cardStringWithLabel: @"Birthday:" value: bday]; } - (NSString *) tz