Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
Date#day_fraction
day_fraction → rational
ext/date/date_core.c
View on GitHub ↗
static VALUE
d_lite_day_fraction(VALUE self)
{
get_d1(self);
if (simple_dat_p(dat))
return INT2FIX(0);
return m_fr(dat);
}
Returns the fractional part of the day in range (Rational(0, 1)…Rational(1, 1)):
Example
DateTime.new(2001,2,3,12).day_fraction # => (1/2)