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

Failing DateTime.strptime for weird dates near epoch #2149

Closed
headius opened this Issue Nov 8, 2014 · 1 comment

Comments

Projects
None yet
4 participants
@headius
Member

headius commented Nov 8, 2014

This test from MRI 2.2 fails on our DateTime.strptime implementation:

  def test_sz
    d = DateTime.strptime('0 -0200', '%s %z')
    assert_equal([1969, 12, 31, 22, 0, 0], [d.year, d.mon, d.mday, d.hour, d.min, d.sec])
    assert_equal(Rational(-2, 24), d.offset)
    d = DateTime.strptime('9 +0200', '%s %z')
    assert_equal([1970, 1, 1, 2, 0, 9], [d.year, d.mon, d.mday, d.hour, d.min, d.sec])
    assert_equal(Rational(2, 24), d.offset)

    d = DateTime.strptime('0 -0200', '%Q %z')
    assert_equal([1969, 12, 31, 22, 0, 0], [d.year, d.mon, d.mday, d.hour, d.min, d.sec])
    assert_equal(Rational(-2, 24), d.offset)
    d = DateTime.strptime('9000 +0200', '%Q %z')
    assert_equal([1970, 1, 1, 2, 0, 9], [d.year, d.mon, d.mday, d.hour, d.min, d.sec])
    assert_equal(Rational(2, 24), d.offset)

  end

Failure:

TestDateStrptime#test_sz [/Users/headius/projects/jruby/test/mri/date/test_date_strptime.rb:497]:
<[1969, 12, 31, 22, 0, 0]> expected but was
<[1970, 1, 1, 0, 0, 0]>.

Can run using `jruby test/mri/runner.rb date/test_date_strptime.rb

I will exclude this test for now.

@jaredholdcroft

This comment has been minimized.

Show comment
Hide comment
@jaredholdcroft

jaredholdcroft Jan 8, 2015

Looks like a good issue to make a start on so I'm going to take a look at this.

jaredholdcroft commented Jan 8, 2015

Looks like a good issue to make a start on so I'm going to take a look at this.

skmp added a commit to skmp/jruby that referenced this issue Jul 8, 2015

Fix date.rewrite_frags
According to MRI, offset should be preserved and
added to the seconds.

Fixes #2149

@enebo enebo modified the milestone: JRuby 9.0.0.0 Jul 14, 2015

kares added a commit to kares/jruby that referenced this issue Nov 13, 2015

kares added a commit that referenced this issue Nov 13, 2015

Fix date.rewrite_frags
According to MRI, offset should be preserved and
added to the seconds.

Fixes #2149

kares added a commit that referenced this issue Nov 13, 2015

@kares kares closed this in a0b6eda Nov 13, 2015

@kares kares added this to the JRuby 9.0.5.0 milestone Nov 13, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment