DateTime.jd raises 'invalid fraction' when called with more than one argument
Since trunk revision 31862, the DateTime.jd function raises an ArgumentError with message 'invalid fraction' when it is called with more than one argument. For example,
DateTime.jd(Rational(39014323, 16), 0)
ArgumentError: invalid fraction
Calling DateTime.jd without the second parameter (and relying on the default value) works as expected:
I think the problem may be the 'argc > n' tests in the num2num_with_frac and num2int_with_frac #defines in ext/date/date_core.c. The attached patch changes the tests to 'argc < n'. This makes jd function properly again with more than one argument.
#2 [ruby-core:36812] Updated by tadayoshi funaba over 5 years ago
- Status changed from Open to Rejected
- Assignee set to tadayoshi funaba
i've never seen such a nonsense patch.
this is not a bug.
you cannot specify both fraction and hour.
DateTime.new(2001,2,28.5,12) should mean 2001-03-31??
we have to be cautious about such a abuse.