Date arithmetic can add days and compare two fixed calendar dates.

Duration Calculations

duration_calculations.rb
require "date"

days_to_add = 
start_date = Date.new(2025, 5, 1)
due_date = start_date + days_to_add

span = (due_date - start_date).to_i

puts "start=#{start_date.iso8601}"
puts "due=#{due_date.iso8601}"
puts "span_days=#{span}"
require "date"

days_to_add = 
start_date = Date.new(2025, 5, 1)
due_date = start_date + days_to_add

span = (due_date - start_date).to_i

puts "start=#{start_date.iso8601}"
puts "due=#{due_date.iso8601}"
puts "span_days=#{span}"
require "date"

days_to_add = 
start_date = Date.new(2025, 5, 1)
due_date = start_date + days_to_add

span = (due_date - start_date).to_i

puts "start=#{start_date.iso8601}"
puts "due=#{due_date.iso8601}"
puts "span_days=#{span}"
date arithmetic Adding an integer to a `Date` moves forward by that many days.