Project

General

Profile

Actions

Bug #17169

closed

Bad value for range using infinity for Time

Added by isarcasm (Igor Tsykalo) over 3 years ago. Updated over 3 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux]
[ruby-core:100012]

Description

How to reproduce:

-Float::INFINITY...Float::INFINITY # works
Date.today...Float::INFINITY # works
-Float::INFINITY...Date.today # works
Time.now...Float::INFINITY #fails with "ArgumentError: bad value for range"
-Float::INFINITY...Time.now #fails with "ArgumentError: bad value for range"

I don't see why there should be a difference in this respect between Date and Time

This is issue is related to https://bugs.ruby-lang.org/issues/12961 which is Closed but actually only fixed the Date case.

P.S.: The Time.now...Float::INFINITY works with Rails' ActiveSupport via Time monkey-patching. However, monkey patching Float feels riskier.

Actions

Also available in: Atom PDF

Like0
Like0Like0