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

Make Duration _repr_ match toString() output #1375

Closed
wants to merge 1 commit into from

Conversation

justingrant
Copy link
Collaborator

Fixes #1371

@codecov
Copy link

codecov bot commented Feb 19, 2021

Codecov Report

Merging #1375 (88a6dff) into main (b7c4ac8) will decrease coverage by 0.01%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1375      +/-   ##
==========================================
- Coverage   95.26%   95.24%   -0.02%     
==========================================
  Files          19       19              
  Lines       11123    11125       +2     
  Branches     1824     1824              
==========================================
  Hits        10596    10596              
- Misses        522      524       +2     
  Partials        5        5              
Flag Coverage Δ
test262 48.45% <ø> (ø)
tests 90.96% <0.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
polyfill/lib/duration.mjs 97.52% <0.00%> (-0.31%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b7c4ac8...cab49a8. Read the comment docs.

Copy link
Collaborator

@ptomato ptomato left a comment

Choose a reason for hiding this comment

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

Good catch, I had found the other day that this was broken in toJSON() and included a fix in #1370 but had missed this one.

It should be OK to just add ES.TemporalDurationToString(this, 'auto') though.

@justingrant
Copy link
Collaborator Author

justingrant commented Feb 19, 2021

Good catch, I had found the other day that this was broken in toJSON() and included a fix in #1370 but had missed this one.

It should be OK to just add ES.TemporalDurationToString(this, 'auto') though.

Given that #1370 seems to fix most of these cases, do you want to just fix _repr_ in #1370 too instead of spreading fixes for essentially the same bug across multiple PRs?

BTW, instead of updating all callsites to use an 'auto' parameter, would a better fix be to treat undefined as 'auto' in ES.TemporalDurationToString? It seems odd that the default behavior of ES.TemporalDurationToString isn't the same as 'auto'.

@ptomato
Copy link
Collaborator

ptomato commented Feb 19, 2021

Yeah, makes sense. I'll close this and pull out that fix from the other PR into a new PR.

@ptomato ptomato closed this Feb 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unexpected zero seconds shown in Duration.prototype._repr_ output
2 participants