Opened 13 months ago
Closed 13 months ago
#1004 closed defect (fixed)
Comment createdDates are incorrect.
| Reported by: | aerych | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | 3.0 |
| Component: | Comments | Version: | 2.9 |
| Keywords: | Cc: |
Description
If you add a comment on your blog and then check the date stamp of the comment in the iOS app you will see that the date stamp is several hours in the future.
To reproduce:
- Add a new comment to your blog via a browser.
- In the iOS app refresh the comments list for the blog.
- Tap to view the new comment's details.
Some investigation points to the gmt date delivered from the api call being incorrectly parsed/stored. Comments for me are showing up 10 hours in the future (I'm gmt+5). Maybe the gmt offset is being doubled and added to the date?
Attachments (1)
Change History (6)
comment:1 Changed 13 months ago by koke
- Milestone changed from 3.0 to 2.10
Changed 13 months ago by aerych
comment:2 Changed 13 months ago by aerych
Here is what I think is happening.
When the xmlrpc result is parsed in this call:
XMLRPCEventBasedParserDelegate.m
- (NSDate *)parseDateString: (NSString *)dateString withFormat: (NSString *)format;
dates are parsed assuming the the system's timezone. Since the comment date is already gmt, it is incorrectly applying the gmt offset again when its parsed. Dates returned by the post and page apis are not send down as gmt so the offset is correctly applied then they are parsed.
The patch I've uploaded offers a work around but I'm not sure its the best approach.
comment:3 Changed 13 months ago by koke
This is what we do for Posts:
- (NSDate *)dateCreated {
if(self.date_created_gmt != nil)
return [DateUtils GMTDateTolocalDate:self.date_created_gmt];
else
return nil;
}
- (void)setDateCreated:(NSDate *)localDate {
if(localDate == nil)
self.date_created_gmt = nil;
else
self.date_created_gmt = [DateUtils localDateToGMTDate:localDate];
}
comment:4 Changed 13 months ago by aerych
Oh this approach is much nicer.
comment:5 Changed 13 months ago by aerych
- Resolution set to fixed
- Status changed from new to closed
Fixed in [2549]

patch offering a work around for wonky comment dates