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

Node/V8 currently disagrees with 6 Date.parse tests. #4

Closed
jdalton opened this issue Sep 15, 2024 · 3 comments
Closed

Node/V8 currently disagrees with 6 Date.parse tests. #4

jdalton opened this issue Sep 15, 2024 · 3 comments

Comments

@jdalton
Copy link

jdalton commented Sep 15, 2024

Just a heads up that builtin Date.parse of Node 20/22 fails 6 unit tests in Date.parse. I'm not sure if it's a bug on them or the shim. Just raising awareness of the differences.

  • Maybe related to the needsConstructor check V8 will fail one check for allowing invalid dates: Date.parse('2012-11-31T23:59:59.000Z')
  • Maybe related to the polyfill/shim juggle
@ljharb
Copy link
Member

ljharb commented Sep 24, 2024

I see only 2 failures in latest node:

not ok 1 2012-11-31T23:59:59.000Z is an invalid date
  ---
    operator: equal
    expected: NaN
    actual:   1354406399000
    at: <anonymous> ($PWD/test/Date.parse/tests.js:24:7)
    stack: |-
      Error: 2012-11-31T23:59:59.000Z is an invalid date
          at Test.assert [as _assert] ($PWD/node_modules/tape/lib/test.js:492:48)
          at Test.strictEqual ($PWD/node_modules/tape/lib/test.js:670:7)
          at $PWD/test/Date.parse/tests.js:24:7
          at forEachArray ($PWD/node_modules/for-each/index.js:12:17)
          at forEach ($PWD/node_modules/for-each/index.js:54:9)
          at Test.<anonymous> ($PWD/test/Date.parse/tests.js:23:3)
          at Test.run ($PWD/node_modules/tape/lib/test.js:126:28)
          at Test._end ($PWD/node_modules/tape/lib/test.js:398:5)
          at Test.end ($PWD/node_modules/tape/lib/test.js:211:7)
          at Test.<anonymous> ($PWD/test/Date.parse/builtin.js:10:4)
  ...

not ok 13 2011-02-29T12:00:00.000Z is an invalid date
  ---
    operator: equal
    expected: NaN
    actual:   1298980800000
    at: <anonymous> ($PWD/test/Date.parse/tests.js:24:7)
    stack: |-
      Error: 2011-02-29T12:00:00.000Z is an invalid date
          at Test.assert [as _assert] ($PWD/node_modules/tape/lib/test.js:492:48)
          at Test.strictEqual ($PWD/node_modules/tape/lib/test.js:670:7)
          at $PWD/test/Date.parse/tests.js:24:7
          at forEachArray ($PWD/node_modules/for-each/index.js:12:17)
          at forEach ($PWD/node_modules/for-each/index.js:54:9)
          at Test.<anonymous> ($PWD/test/Date.parse/tests.js:23:3)
          at Test.run ($PWD/node_modules/tape/lib/test.js:126:28)
          at Test._end ($PWD/node_modules/tape/lib/test.js:398:5)
          at Test.end ($PWD/node_modules/tape/lib/test.js:211:7)
          at Test.<anonymous> ($PWD/test/Date.parse/builtin.js:10:4)
  ...

with builtin.js:

'use strict';

var test = require('tape');

var runTests = require('./tests');

test('builtin', function (t) {
    runTests(Date.parse, t);

    t.end();
});

@ljharb
Copy link
Member

ljharb commented Sep 24, 2024

(notably, these two dates do fail in Safari, but pass in Firefox)

@jdalton
Copy link
Author

jdalton commented Oct 3, 2024

Thanks for digging in and showing the example builtin.js test.

@jdalton jdalton closed this as completed Oct 3, 2024
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

No branches or pull requests

2 participants