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

Remove some internal TimeZone method calls #1397

Merged
merged 2 commits into from
Mar 2, 2021
Merged

Conversation

ptomato
Copy link
Collaborator

@ptomato ptomato commented Feb 27, 2021

Found this bug while investigating #1294.

@codecov
Copy link

codecov bot commented Feb 27, 2021

Codecov Report

Merging #1397 (d257a01) into main (cbbe002) will decrease coverage by 46.67%.
The diff coverage is 66.66%.

Impacted file tree graph

@@             Coverage Diff             @@
##             main    #1397       +/-   ##
===========================================
- Coverage   95.71%   49.03%   -46.68%     
===========================================
  Files          19       18        -1     
  Lines       11169     4982     -6187     
  Branches     1812     1089      -723     
===========================================
- Hits        10690     2443     -8247     
- Misses        476     2128     +1652     
- Partials        3      411      +408     
Flag Coverage Δ
test262 49.03% <66.66%> (-0.02%) ⬇️
tests ?

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

Impacted Files Coverage Δ
polyfill/lib/intl.mjs 65.89% <ø> (-34.11%) ⬇️
polyfill/lib/plaindate.mjs 49.38% <0.00%> (-46.66%) ⬇️
polyfill/lib/plaintime.mjs 55.12% <0.00%> (-41.50%) ⬇️
polyfill/lib/zoneddatetime.mjs 42.56% <45.45%> (-55.37%) ⬇️
polyfill/lib/ecmascript.mjs 55.22% <70.21%> (-40.78%) ⬇️
polyfill/lib/now.mjs 100.00% <100.00%> (ø)
polyfill/lib/plaindatetime.mjs 54.31% <100.00%> (-41.20%) ⬇️
polyfill/lib/timezone.mjs 63.63% <100.00%> (-32.08%) ⬇️
polyfill/lib/calendar.mjs 16.72% <0.00%> (-77.45%) ⬇️
polyfill/lib/duration.mjs 53.36% <0.00%> (-44.94%) ⬇️
... and 15 more

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 cbbe002...d257a01. Read the comment docs.

Copy link
Collaborator

@cjtenny cjtenny left a comment

Choose a reason for hiding this comment

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

Looks good. I'll collect observability & ordering of this into the test262 work items issue as well!

@cjtenny cjtenny mentioned this pull request Feb 27, 2021
44 tasks
@ptomato ptomato force-pushed the internal-method-calls branch from 43e3e82 to 1ca37be Compare March 1, 2021 20:02
@ptomato
Copy link
Collaborator Author

ptomato commented Mar 1, 2021

I went to fix the test262 suite which I had forgotten to do on Friday, and realized that I'd overlooked changing GetOffsetStringFor into BuiltinTimeZoneGetOffsetStringFor. @cjtenny would you mind taking another quick look?

@ptomato ptomato force-pushed the internal-method-calls branch from 1ca37be to a37d835 Compare March 1, 2021 23:26
Copy link
Collaborator

@cjtenny cjtenny left a comment

Choose a reason for hiding this comment

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

lgtm!

return dateTime;
getOffsetNanosecondsFor() {
actual.push("call timeZone.getOffsetNanosecondsFor");
return -8735135802468;
Copy link
Collaborator

Choose a reason for hiding this comment

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

are these numbers just different keyboard mashings?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't know where 160583136123456789n came from below, but this is the number that yields a PlainDateTime whose time is 12:00:00.987654321.

ptomato added 2 commits March 1, 2021 17:50
…ng}For

We define the time zone protocol as an object that must have the three
methods getOffsetNanosecondsFor, getPossibleInstantsFor, and toString on
it. Other methods can be called by user code but should not be called by
Temporal. Unfortunately, getInstantFor and getPlainDateTimeFor were called
extensively, and getOffsetStringFor in a few places.

This probably leaked in to the polyfill and spec text when adding
ZonedDateTime! Only the documentation was correct about this.
I noticed this discrepancy between the polyfill and spec text. I believe
this is a bug in the spec text, because otherwise if you have a PlainFoo
object representing a wall-clock time that doesn't exist or is repeated in
the DateTimeFormat's time zone, you could not call toLocaleString() on it.
@ptomato ptomato force-pushed the internal-method-calls branch from a37d835 to d257a01 Compare March 2, 2021 01:51
@ptomato ptomato merged commit ca5c22d into main Mar 2, 2021
@ptomato ptomato deleted the internal-method-calls branch March 2, 2021 02:08
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.

2 participants