Monday_of_this_week1.rb
This content was produced by an LLM and could include errors.
This script loads the Date library, capturing today’s date and then calculating the date of the most recent preceding Monday.
require 'date'
#=> true
today = Date.today
#=> #<Date: 2026-05-07 ((2461168j,0s,0n),+0s,2299161j)>
this_monday = today - today.wday + 1
#=> #<Date: 2026-05-04 ((2461165j,0s,0n),+0s,2299161j)>
Ruby 4.0.3