サマータイムの開始と終了により、時間の解析に問題があるようです。問題の RSS フィードのアイテムには次のようなものがあります。
<item>
<title><![CDATA[Men's & Ladies Bible Class Widows Luncheon]]></title>
<description><![CDATA[(Tue, 02 Apr 2013 11 am - 1 pm EST)
]]></description>
<pubDate>Tue, 02 Apr 2013 11:00:00 EST</pubDate>
<link>http://www.localendar.com/elsie?DAM=PublishedEvent&event_id=315&calendar_id=199640&k=040213&cb=false</link>
<guid>http://www.localendar.com/elsie?DAM=PublishedEvent&event_id=315&calendar_id=199640&k=040213&cb=false</guid>
</item>
<item>
<title><![CDATA[Wednesday Night Services]]></title>
<description><![CDATA[(Wed, 03 Apr 2013 7 pm - 8 pm EST)
]]></description>
<pubDate>Wed, 03 Apr 2013 19:00:00 EST</pubDate>
<link>http://www.localendar.com/elsie?DAM=PublishedEvent&event_id=283&calendar_id=199640&k=040313&cb=false</link>
<guid>http://www.localendar.com/elsie?DAM=PublishedEvent&event_id=283&calendar_id=199640&k=040313&cb=false</guid>
</item>
私のアプリでは、detailTextLabel に日付と時刻が表示されます。テーブルの行のコードは次のとおりです。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
}
RSSEntryCalendar *entry = [_allEntries objectAtIndex:indexPath.row];
NSDateFormatter * dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
[dateFormatter setTimeStyle:NSDateFormatterMediumStyle];
[dateFormatter setDateStyle:NSDateFormatterMediumStyle];
[dateFormatter setTimeZone:[NSTimeZone timeZoneWithName:@"America/New_York"]];
NSString *articleDateString = [dateFormatter stringFromDate:entry.articleDate];
cell.textLabel.text = entry.articleTitle;
cell.detailTextLabel.text = [NSString stringWithFormat:@"%@ - %@", articleDateString, entry.blogTitle];
return cell;
}
すべてのイベントの場所は東部時間帯です。そのため、設定された時間帯として東部標準時を使用しています。これにより、タイムゾーンで等しいものだけでなく、すべてが東部標準時で表示されるようになります。
問題は、私が例として投稿した 2 つのエントリは、pubDate カテゴリの時間に 11 と 7 を示しているのに、アプリはそれを 12 と 8 として書き込むことです。
これを修正する方法について何か考えはありますか?カレンダー自体で何らかの設定を行う必要がありますか、それともアプリで何か間違ったことをしていますか?