in reply to Re: Is there an easy way to get the start date of the current week?
in thread Is there an easy way to get the start date of the current week?

It doesn't find the current week — it finds the week before and after a reference date — and it's more elaborate than necessary.

For Sunday,

my $dt = DateTime->today(); my $dow = $dt->day_of_week(); $dt->substract( days => $dow % 7 );

For Monday,

my $dt = DateTime->today(); my $dow = $dt->day_of_week(); $dt->substract( days => ( $dow + 6 ) % 7 );