Closed yaelirub closed 5 years ago
Thanks so much @stevebaranski . Investigating further and will update.
Hey @stevebaranski . I updated the PR. Please let me know what you think
@yaelirub I checked out the branch, and the relativeStringDate
seems to be working in my manual tests. That said, I noticed that the ago
suffix isn't localized like it was previously in/with FormatterKit
.
This piqued my interest. So, I created a Swift playground to illustrate that you can accomplish most of what needs to be done with DateComponentsFormatter
. While the class evinces locale-sensitive intervals, it does not appear to be capable of adding the "ago" suffix either, which FormatterKit
refers to as "idiomatic deictic expressions".
If we resolve to remove FormatterKit
and maintain parity for existing WPiOS callers of Date.mediumString()
, I believe we'd need to do a few things:
relativeStringDate
, as I don't think GlotPress is currently setup for this framework (I don't see existing localized strings in here).mediumString()
method to behave like the playground; we might want two formatters based on whether we're looking at an interval greater than or less than 24 hours.mediumString
method to a new method that calls mediumString()
, but also appends ago
in a locale-sensitive way when the interval is in the past.Given this new information, do you think it's worthwhile to proceed with the effort as we described?
@stevebaranski . Thanks for the information. Honestly, I'm not sure anymore. Sounds like FormatterKit might have value still?Especially since DateComponentsFormatter doesn't provide relativity in dates. What do you think?
@yaelirub I'm okay with closing this. It might be worth creating an issue with our findings, in the event someone else would like to take it on.
Everything but the "ago" bit sees to be available via DateComponentsFormatter
. Perhaps we could file a Radar to add it, in much the same way as "time remaining" is added via includesTimeRemainingPhrase
.
I really appreciate you investigating this one!
Closing this. Opened issue #177
As per @stevebaranski suggestion in p77Llu-bxU-p2#comment-12227 Also removed unused function toStringForPageSections.
instead of using the TTTTimeIntervalFormatter for dates that are less than a week ago we use our own relativeStringDate() This implementation does not include future dates formatting ("from now"). It seems to me like "from now" was not used in the app (looked at scheduled posts) let me know if I'm wrong and it is used and needed.