End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Date#prev_month
d.prev_month([n=1]) → date
ext/date/date_core.c
View on GitHub ↗
static VALUE
d_lite_prev_month(int argc, VALUE *argv, VALUE self)
{
VALUE n;
rb_scan_args(argc, argv, "01", &n);
if (argc < 1)
n = INT2FIX(1);
return d_lite_lshift(self, n);
}
This method is equivalent to d << n.
See Date#<< for examples.