dates: add or subtract a month
require "date"
# Create a date
d = Date.new(2021, 5, 31)
# Subtract one month
subtract = d << 1
# Add one month
add = d >> 1
# Display values.
puts subtract # it didn't just adjust the month
puts d # base date
puts add # days are adjusted to get actual end of month