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

Test suite fails when current UTC offset is not -0500 #5

Closed
nclavaud opened this issue Dec 9, 2016 · 2 comments
Closed

Test suite fails when current UTC offset is not -0500 #5

nclavaud opened this issue Dec 9, 2016 · 2 comments

Comments

@nclavaud
Copy link
Contributor

nclavaud commented Dec 9, 2016

Hi,

Running the test suite here fails:

 FAIL  tests/index.js
  react-moment
    ✕ children (34ms)
    ✕ date (6ms)
    ✕ parse (3ms)
    ✓ format (3ms)
    ✓ fromNow (10ms)
    ✓ from (10ms)
    ✓ toNow (10ms)
    ✓ to (10ms)
    ✓ calendar (3ms)
    ✕ unix (3ms)
    ✓ utc (4ms)
    ✓ other (4ms)

  ● react-moment › children

    expect(received).toEqual(expected)
    
    Expected value to equal:
      "Mon Apr 19 1976 12:59:00 GMT-0500"
    Received:
      "Mon Apr 19 1976 17:59:00 GMT+0000"
      
      at Object.<anonymous> (tests/index.js:26:91)

  ● react-moment › date

    expect(received).toEqual(expected)
    
    Expected value to equal:
      "Mon Apr 19 1976 12:59:00 GMT-0500"
    Received:
      "Mon Apr 19 1976 17:59:00 GMT+0000"
      
      at Object.<anonymous> (tests/index.js:44:91)

  ● react-moment › parse

    expect(received).toEqual(expected)
    
    Expected value to equal:
      "Mon Apr 19 1976 12:59:00 GMT-0500"
    Received:
      "Mon Apr 19 1976 12:59:00 GMT+0000"
      
      at Object.<anonymous> (tests/index.js:56:91)

  ● react-moment › unix

    expect(received).toEqual(expected)
    
    Expected value to equal:
      "Mon Apr 19 1976 12:59:00 GMT-0500"
    Received:
      "Mon Apr 19 1976 17:59:00 GMT+0000"
      
      at Object.<anonymous> (tests/index.js:134:91)

Test Summary
 › Ran all tests.
 › 4 tests failed, 8 tests passed (12 total in 1 test suite, run time 1.077s)

I guess this has something to do with the UTC offset, either the parsing or the formatting.

@nclavaud
Copy link
Contributor Author

nclavaud commented Dec 9, 2016

I was running the test suite from a Docker container, using the official node image. I managed to make it pass by setting the timezone to New York:

$ docker run -it --rm -v $PWD:/opt -w /opt -e "TZ=America/New_York" node npm test

 PASS  tests/index.js
  react-moment
    ✓ children (34ms)
    ✓ date (9ms)
    ✓ parse (2ms)
    ✓ format (3ms)
    ✓ fromNow (10ms)
    ✓ from (12ms)
    ✓ toNow (9ms)
    ✓ to (7ms)
    ✓ calendar (5ms)
    ✓ unix (3ms)
    ✓ utc (2ms)
    ✓ other (4ms)

Test Summary
 › Ran all tests.
 › 12 tests passed (12 total in 1 test suite, run time 1.054s)

@nclavaud nclavaud changed the title Test suite fails Test suite fails when current UTC offset is not -0500 Dec 9, 2016
@headzoo
Copy link
Owner

headzoo commented Dec 30, 2016

I'm honestly not sure what to do about that. Still giving it some thought.

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