Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Localize date based on user's region #20

Merged
merged 2 commits into from

2 participants

@nikreiman

Instead of hardcoding in the date formatting, use the phone defaults for the user region. This leads to a more consistent UI experience for the user.

@shnhrrsn shnhrrsn merged commit 743679f into enormego:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 30, 2011
  1. @nikreiman

    Fixing minor warning

    nikreiman authored
  2. @nikreiman
This page is out of date. Refresh to see the latest.
View
14 EGOTableViewPullRefresh/Classes/View/EGORefreshTableHeaderView.m
@@ -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];
@@ -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 {
Something went wrong with that request. Please try again.