diff --git a/UI/MailerUI/English.lproj/Localizable.strings b/UI/MailerUI/English.lproj/Localizable.strings index 02466f5b5..5d3b392cd 100644 --- a/UI/MailerUI/English.lproj/Localizable.strings +++ b/UI/MailerUI/English.lproj/Localizable.strings @@ -152,6 +152,8 @@ "No message" = "No message"; "messages" = "messages"; +"Yesterday" = "Yesterday"; + "first" = "First"; "previous" = "Previous"; "next" = "Next"; diff --git a/UI/MailerUI/UIxMailListActions.h b/UI/MailerUI/UIxMailListActions.h index 7aa7709f0..1d6605006 100644 --- a/UI/MailerUI/UIxMailListActions.h +++ b/UI/MailerUI/UIxMailListActions.h @@ -34,6 +34,7 @@ { NSArray *sortedUIDs; /* we always need to retrieve all anyway! */ NSArray *messages; + NSCalendarDate *now; id message; SOGoDateFormatter *dateFormatter; NSTimeZone *userTimeZone; diff --git a/UI/MailerUI/UIxMailListActions.m b/UI/MailerUI/UIxMailListActions.m index a411e06bf..677d642d4 100644 --- a/UI/MailerUI/UIxMailListActions.m +++ b/UI/MailerUI/UIxMailListActions.m @@ -80,8 +80,10 @@ if ((self = [super initWithRequest: newRequest])) { user = [[self context] activeUser]; + ASSIGN (now, [NSCalendarDate calendarDate]); ASSIGN (dateFormatter, [user dateFormatterInContext: context]); ASSIGN (userTimeZone, [[user userDefaults] timeZone]); + [now setTimeZone: userTimeZone]; sortByThread = [[user userDefaults] mailSortByThreads]; folderType = 0; specificMessageNumber = 0; @@ -119,7 +121,19 @@ messageDate = [[message valueForKey: @"envelope"] date]; [messageDate setTimeZone: userTimeZone]; - return [dateFormatter formattedDateAndTime: messageDate]; + if ([now dayOfCommonEra] == [messageDate dayOfCommonEra]) + { + // Same day + return [dateFormatter formattedTime: messageDate]; + } + else if ([now dayOfCommonEra] - [messageDate dayOfCommonEra] == 1) + { + return [self labelForKey: @"Yesterday"]; + } + else + { + return [dateFormatter formattedDate: messageDate]; + } } - (UIxMailSizeFormatter *) sizeFormatter