wordpress-mobile / WordPress-iOS-Shared

Shared components used in building the WordPress iOS apps and other library components
GNU General Public License v2.0
18 stars 22 forks source link

Allow adjustment of Date display strings by Time Zone #240

Closed bjtitus closed 4 years ago

bjtitus commented 4 years ago

WPiOS PR #13265

Addresses an issue with display strings for posts using the device instead of site time zone: https://github.com/wordpress-mobile/WordPress-iOS/issues/13258

Some additions to NSDate+Helpers to adjust the display string for a date based on an optional time zone. The default formatters use the device's time zone but we want to show the site time zone in many cases.

There is some performance penalty for this: about 2x as slow as not manipulating the time zone on the formatters. I think a cache could be added at some point but I'm not sure it's worth doing right now.

Added two tests: