===
    indeed truncating to any day of the week can be implemented by user
    trivially by adding/subtracting a constant number of days from the
    Monday returned.


No, it's not a constant.

$sun = DateTime.new('2010-04-11').trunc( :to<sunday> )   # 2010-04-11
$mon = DateTime.new('2010-04-11').trunc( :to<monday> )   # 2010-04-05
$sun - $mon ==  6 days

$sun = DateTime.new('2010-04-12').trunc( :to<sunday> )   # 2010-04-11
$mon = DateTime.new('2010-04-12').trunc( :to<monday> )   # 2010-04-12
$sun - $mon == -1 day
===
You're not understanding me right- the addition & subtraction have to
happen twice. (Ever had to truncate to an arbitrary multiple of 10 for
example?)

$sunday =DateTime.new(date_in_question+1 day).trunc( :to<monday>) - 1 day

Reply via email to