Format birthday on contact card

pull/9/merge
Francis Lachapelle 2013-01-30 08:40:27 -05:00
parent 4e9db74e29
commit d8804c699d
2 changed files with 21 additions and 1 deletions

1
NEWS
View File

@ -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

View File

@ -30,6 +30,9 @@
#import <NGCards/NSArray+NGCards.h>
#import <NGExtensions/NSString+Ext.h>
#import <SOGo/NSCalendarDate+SOGo.h>
#import <SOGo/SOGoDateFormatter.h>
#import <SOGo/SOGoUser.h>
#import <Contacts/SOGoContactObject.h>
#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