Skip to content

Time.new nanosecond parsing #8788

@ankane

Description

@ankane

Nanoseconds can be parsed incorrectly with JRuby 10:

require "time"

t = Time.new("2025-04-20T23:20:13.789698000Z")
p t
p t.nsec

Environment Information

  • jruby 10.0.0.0 (3.4.2) 2025-04-13 6ed59bc OpenJDK 64-Bit Server VM 21.0.6 on 21.0.6 +indy +jit [arm64-darwin]
  • macOS 15.4.1 arm64

Expected Behavior

CRuby 3.4.2 output

2025-04-20 23:20:13.789698 UTC
789698000

Actual Behavior

JRuby 10.0.0.0 output

2025-04-20 23:20:13.000007896 +0000
7896

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions