This repository was archived by the owner on Dec 15, 2020. It is now read-only.
Open
Conversation
|
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
Author
|
I signed it! |
|
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
| /// Example: "One hour 46 minutes 11 seconds" and "One second 250 milliseconds". | ||
| var accessibleDurationString: String { | ||
| return TimeInterval.accessibleIntervalFormatter.string(from: self) ?? "" | ||
| return TimeInterval.accessibleIntervalFormatter.string(from: self, appending: fractional) |
Contributor
There was a problem hiding this comment.
We're currently discussing this path because of a few issues:
- In an ideal world, we'd use our existing DateComponentsFormatter to simply use milliseconds since it does the localization for us including locale ordering, etc. But obviously DCF doesn't support anything smaller than seconds.
- The issue with appending this formatted string onto the end of the existing a11y string is that, in some locales, this might not be correct. We're not entirely sure, but given the history of how locales work it's entirely possible there's a locale in which milliseconds come first, perhaps.
- We don't have a good solution to present instead 😅
We'll discuss a bit more internally and circle back to you on this. Greatly appreciate your PR and your patience. Thanks!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist
Motivation and Context
Milliseconds do not to really seem be supported in any of the date formatting or NSCalendar APIs. Because of that, there is issue #19.
Description
This PR adds a fractional seconds calculation to TimeInterval and a string formatter to DateComponentsFormatter that will append any available fractional seconds as milliseconds (it also adds a localizable string for "milliseconds"). This PR includes s a unit test to verify said code.