Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #106

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Update README.md #106

wants to merge 4 commits into from

Conversation

romulocintra
Copy link
Member

Close #104

README.md Outdated
milliseconds: "narrow",
fractionalDigits: 2,
}).format(duration);
// => 12s 345.60ms
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current spec draft text uses Intl.ListFormat, which means the results will look more like:
12 seconds, 345 milliseconds, and 600 microseconds and
12 seconds, 345ms, and 600 microseconds.

};

new Intl.DurationFormat("en").format(duration);
// => 2 hr 46 min 40 sec
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 hours, 46 minutes, and 40 seconds according to the current draft text.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/tc39/proposal-intl-duration-format/pull/127/files guess this modifies the behaviour you explain

Copy link
Collaborator

@ben-allen ben-allen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correctly matches behavior of Intl.ListFormat. Current spec doesn't seem to do fractionalDigits correctly, though? Might need to be another issue


// Example using fractionalDigits
new Intl.DurationFormat("en", { fractionalDigits: 2 }).format(duration);
// => 12 sec, 345 ms, 600 μs
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to reduce the surprise with this behavior, a solution would be to set the default style for milliseconds, microseconds, and nanoseconds to be "numeric", even in non-digital styles.

Either way, please include an example with fractionalDigits and digital format.

@ryzokuken
Copy link
Member

Let's get back to this once we've finalized all the normative issues?

@sffc
Copy link
Collaborator

sffc commented Aug 23, 2023

@ben-allen has a new PR in #168 which makes most of these changes; after that PR is merged, Ben will take one final look at this PR and close it if all of its loose ends have been resolved.

@ryzokuken ryzokuken added the documentation Improvements or additions to documentation label Oct 20, 2023
@ryzokuken
Copy link
Member

#168 has been merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update Readme accordingly with recent updates
5 participants