Skip to content

Can't load time with year greater than or equal to 10000 #393

@jcbpl

Description

@jcbpl

Steps to reproduce

require "psych"
require "time"
require "minitest/autorun"

class YearTenThousandTest < Minitest::Test
  def test_year_ten_thousand
    time = Time.parse("10000-01-01 00:00:00")

    yaml_string = Psych.dump(time)
    yaml_time = Psych.load(yaml_string)

    assert_equal yaml_time, time
  end
end

Expected behavior

Expected Psych.load to return a Time object, like it does for years <= 9999.

Actual behavior

It returns a string.

System configuration

Ruby version: 2.6.1

Originally reported as rails/rails#35783

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions