Skip to content

Commit

Permalink
Merge pull request enormego#20 from wrapp/dateformatting
Browse files Browse the repository at this point in the history
Localize date based on user's region
  • Loading branch information
shnhrrsn committed May 30, 2011
2 parents f4779a2 + 7e51010 commit 743679f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions EGOTableViewPullRefresh/Classes/View/EGORefreshTableHeaderView.m
Expand Up @@ -41,7 +41,7 @@ @implementation EGORefreshTableHeaderView


- (id)initWithFrame:(CGRect)frame arrowImageName:(NSString *)arrow textColor:(UIColor *)textColor {
if (self = [super initWithFrame:frame]) {
if((self = [super initWithFrame:frame])) {

self.autoresizingMask = UIViewAutoresizingFlexibleWidth;
self.backgroundColor = [UIColor colorWithRed:226.0/255.0 green:231.0/255.0 blue:237.0/255.0 alpha:1.0];
Expand Down Expand Up @@ -112,14 +112,14 @@ - (void)refreshLastUpdatedDate {

NSDate *date = [_delegate egoRefreshTableHeaderDataSourceLastUpdated:self];

NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setAMSymbol:@"AM"];
[formatter setPMSymbol:@"PM"];
[formatter setDateFormat:@"MM/dd/yyyy hh:mm:a"];
_lastUpdatedLabel.text = [NSString stringWithFormat:@"Last Updated: %@", [formatter stringFromDate:date]];
[NSDateFormatter setDefaultFormatterBehavior:NSDateFormatterBehaviorDefault];
NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
[dateFormatter setDateStyle:NSDateFormatterShortStyle];
[dateFormatter setTimeStyle:NSDateFormatterShortStyle];

_lastUpdatedLabel.text = [NSString stringWithFormat:@"Last Updated: %@", [dateFormatter stringFromDate:date]];
[[NSUserDefaults standardUserDefaults] setObject:_lastUpdatedLabel.text forKey:@"EGORefreshTableView_LastRefresh"];
[[NSUserDefaults standardUserDefaults] synchronize];
[formatter release];

} else {

Expand Down

0 comments on commit 743679f

Please sign in to comment.