From 6e9948e949820321ed59bdd49124b7d1ef9ad3b5 Mon Sep 17 00:00:00 2001 From: Gregory Bartholomew Date: Apr 14 2022 01:06:01 +0000 Subject: Fix discourse::post routine (bad datetime math) --- diff --git a/bot/commands/discourse.pm b/bot/commands/discourse.pm index 04a92a7..dd92a37 100644 --- a/bot/commands/discourse.pm +++ b/bot/commands/discourse.pm @@ -35,14 +35,14 @@ my sub _isnwk { return '' unless $date =~ m{(\d{4})-(\d{2})-(\d{2})}a; - my $a = THISWEEK->add('weeks' => 1); - my $b = THISWEEK->add('weeks' => 2); + my $a = THISWEEK->clone->add('weeks' => 1); + my $b = THISWEEK->clone->add('weeks' => 2); my $c; eval { $c = DateTime->new( 'year' => $1, 'month' => $2, 'day' => $3, 'time_zone' => 0, - )->truncate('to' => 'local_week'); }; + ) }; return ($@) ? '' : $a < $c < $b; }