Skip to content

Commit

Permalink
Fixes for timezone issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Ole Zorn committed Sep 26, 2011
1 parent 06a7618 commit 4f3fd72
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions Classes/AppleFiscalCalendar.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ - (id)init
NSMutableArray *names = [NSMutableArray array];

NSDateFormatter *sectionTitleFormatter = [[NSDateFormatter new] autorelease];
[sectionTitleFormatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
[sectionTitleFormatter setDateFormat:@"MMMM yyyy"];

for (NSDate *date in dates) {
Expand Down
1 change: 1 addition & 0 deletions Classes/Report.m
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,7 @@ - (NSArray *)allReports
- (NSString *)title
{
NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
[dateFormatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
[dateFormatter setDateStyle:NSDateFormatterShortStyle];
return [dateFormatter stringFromDate:self.startDate];
}
Expand Down
2 changes: 2 additions & 0 deletions Classes/ReportCSVViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ - (void)viewWillAppear:(BOOL)animated
{
NSDateFormatter *formatter = [[[NSDateFormatter alloc] init] autorelease];
[formatter setDateStyle:NSDateFormatterShortStyle];
[formatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
self.navigationItem.title = [formatter stringFromDate:report.startDate];

NSString *csv = [report valueForKeyPath:@"originalReport.content"];
Expand Down Expand Up @@ -105,6 +106,7 @@ - (id)initWithReports:(NSArray *)allReports
if (self) {
reports = [allReports retain];
dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
[dateFormatter setDateStyle:NSDateFormatterMediumStyle];
}
return self;
Expand Down
1 change: 1 addition & 0 deletions Classes/YearView.m
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ - (void)drawRect:(CGRect)rect

NSDateFormatter *monthFormatter = [[NSDateFormatter alloc] init];
[monthFormatter setDateFormat:@"MMMM"];
[monthFormatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
NSCalendar *calendar = [[[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar] autorelease];
NSDateComponents *currentDateComponents = [calendar components:NSYearCalendarUnit | NSMonthCalendarUnit fromDate:[NSDate date]];
NSInteger currentYear = [currentDateComponents year];
Expand Down

0 comments on commit 4f3fd72

Please sign in to comment.