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

Re-enable tests in DateParse2.js #4300

Closed
xiaoyinl opened this issue Nov 21, 2017 · 9 comments
Closed

Re-enable tests in DateParse2.js #4300

xiaoyinl opened this issue Nov 21, 2017 · 9 comments
Assignees
Labels
Milestone

Comments

@xiaoyinl
Copy link
Contributor

In #4067, we've changed the format of Date.toUTCDate for negative years. After this change, some tests in DateParse2.js fail because Date.parse() isn't able to parse negative years in some cases, so these failing tests are disabled in #4067. They should be re-enabled (uncommented) after #4178 is fixed.

Ref: #4067 (comment)

@obastemur
Copy link
Collaborator

Really appreciate the effort but appreciate even more if you do not enable / add negative year tests to xplat. (my 2 cents, if it has a runtime cost, please do not even change for Windows too)

Why => xplat negative years time zone info != what we get from Windows. Correcting that, costs lots of if/else/copy. At the moment, toStringAndToUTCStringYearPadding.js is failing on local xplat and I'm planning to disable it there too.

Curious.. why anyone needs negative years?

@obastemur
Copy link
Collaborator

See #4325

@dilijev
Copy link
Contributor

dilijev commented Nov 27, 2017

Curious.. why anyone needs negative years?

Because it's in the spec.

(Or, more specifically, by my reading of the relevant spec sections, negative years are not out of range and therefore do not cause Date ctor to return NaN and therefore negative years are supported by the spec.)

@obastemur
Copy link
Collaborator

Not sure question/answer matches :) Correct me if I'm wrong but, no real app needs negative years, no?

Probably some wouldn't agree but can we consider twice on any extra ops we will add because of making negative years more spec compliant?

@dilijev
Copy link
Contributor

dilijev commented Nov 27, 2017

If it slows down the common case, absolutely we should consider this being an issue that is so unimportant that it's not worth fixing. If it only slows down the negative years case, there's no cost to the common case, so I don't see why we couldn't fix it there.

@xiaoyinl
Copy link
Contributor Author

I will run a benchmark to see if it slows down common cases.

@dilijev
Copy link
Contributor

dilijev commented Nov 28, 2017

^ @xiaoyinl: We should be able to tell by analyzing the code: if there's already a branch surrounding the logic for the negative year, adding more logic to that block means that only the negative cases will be affected. If this change would require adding a branch to separate positive and negative cases, then we will need to look at the benchmarks to decide if there's a noticable impact.

@xiaoyinl
Copy link
Contributor Author

@dilijev There're a few branches added to separate both cases, like L1240-1245, and L1405-1408. But I'm not sure if this cost is negligible or not for common cases.

@dilijev
Copy link
Contributor

dilijev commented Nov 28, 2017

Ah yes, those new checks will add non-zero overhead, though without a benchmark it's hard to tell how small the overhead will be (although the branch predictor will probably render it even more negligible for the common case).

chakrabot pushed a commit that referenced this issue Jan 17, 2018
… years (Fixes #4178)

Merge pull request #4318 from xiaoyinl:DateParse_zero_padded_years

This PR will finally make `Date.parse` able to parse any output of `Date.toString()`, `Date.toUTCString`, and `Date.toISOString()`.

Fixes #4178
Fixes #4300

Todo:
  - [x] Add, update and re-enable tests (#4300)
  - [x] `new Date("2017-jan-01")` causes an assertion failure
chakrabot pushed a commit that referenced this issue Jan 17, 2018
…d negative years (Fixes #4178)

Merge pull request #4318 from xiaoyinl:DateParse_zero_padded_years

This PR will finally make `Date.parse` able to parse any output of `Date.toString()`, `Date.toUTCString`, and `Date.toISOString()`.

Fixes #4178
Fixes #4300

Todo:
  - [x] Add, update and re-enable tests (#4300)
  - [x] `new Date("2017-jan-01")` causes an assertion failure
chakrabot pushed a commit that referenced this issue Jan 17, 2018
…ize padded and negative years (Fixes #4178)

Merge pull request #4318 from xiaoyinl:DateParse_zero_padded_years

This PR will finally make `Date.parse` able to parse any output of `Date.toString()`, `Date.toUTCString`, and `Date.toISOString()`.

Fixes #4178
Fixes #4300

Todo:
  - [x] Add, update and re-enable tests (#4300)
  - [x] `new Date("2017-jan-01")` causes an assertion failure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants