diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-08-08 23:26:21 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-08-08 23:48:13 +0900 |
commit | 43239b23b48a6c3fde6bdc4b9cc568bedac161b2 (patch) | |
tree | d185d49fdf70a672d40975f053b575e635fb16d5 /spec/ruby/library/datetime | |
parent | e0dfa5967e7063da8b65dc3c062ef4652e246e34 (diff) |
[Bug #18946] New tests for fixed Time/DateTime conversions
Diffstat (limited to 'spec/ruby/library/datetime')
-rw-r--r-- | spec/ruby/library/datetime/to_time_spec.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/ruby/library/datetime/to_time_spec.rb b/spec/ruby/library/datetime/to_time_spec.rb index a03ab67867..88a7aaa739 100644 --- a/spec/ruby/library/datetime/to_time_spec.rb +++ b/spec/ruby/library/datetime/to_time_spec.rb @@ -18,6 +18,19 @@ describe "DateTime#to_time" do time.sec.should == 59 end + version_is(Date::VERSION, '3.2.3') do + it "returns a Time representing the same instant before Gregorian" do + datetime = DateTime.civil(1582, 10, 4, 23, 58, 59) + time = datetime.to_time.utc + time.year.should == 1582 + time.month.should == 10 + time.day.should == 14 + time.hour.should == 23 + time.min.should == 58 + time.sec.should == 59 + end + end + it "preserves the same time regardless of local time or zone" do date = DateTime.new(2012, 12, 24, 12, 23, 00, '+03:00') |