From 4f3fd72caf1e3004128e065b140d3914f41c33fb Mon Sep 17 00:00:00 2001 From: Ole Zorn Date: Mon, 26 Sep 2011 16:45:25 +0200 Subject: [PATCH] Fixes for timezone issues --- Classes/AppleFiscalCalendar.m | 1 + Classes/Report.m | 1 + Classes/ReportCSVViewController.m | 2 ++ Classes/YearView.m | 1 + 4 files changed, 5 insertions(+) diff --git a/Classes/AppleFiscalCalendar.m b/Classes/AppleFiscalCalendar.m index 8b6cd587..cb9be19d 100644 --- a/Classes/AppleFiscalCalendar.m +++ b/Classes/AppleFiscalCalendar.m @@ -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) { diff --git a/Classes/Report.m b/Classes/Report.m index 4599dda3..26f577c3 100644 --- a/Classes/Report.m +++ b/Classes/Report.m @@ -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]; } diff --git a/Classes/ReportCSVViewController.m b/Classes/ReportCSVViewController.m index fd7d69d4..c27d72b9 100644 --- a/Classes/ReportCSVViewController.m +++ b/Classes/ReportCSVViewController.m @@ -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"]; @@ -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; diff --git a/Classes/YearView.m b/Classes/YearView.m index 0462b197..bc09c317 100644 --- a/Classes/YearView.m +++ b/Classes/YearView.m @@ -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];