htmanning has asked for the wisdom of the Perl Monks concerning the following question:
This works well, but is too specific to the time. If $fc_days_limit=7 and it is noon and I make a reservation 7 days from now for 11am, it works. If I make it for 1pm, it shows an error. I need to have it triggered only by the date without including the time. I could parse the timestamp but isn't there an easier way to do it?if ($fc_days_limit) { use DateTime::Duration (); my $days_from_now = $now->clone->add( days=>$fc_days_limit ); if ($reservation_date > $days_from_now) { #show error } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DateTime days limit
by Corion (Patriarch) on Apr 20, 2020 at 21:16 UTC | |
by htmanning (Friar) on Apr 20, 2020 at 21:28 UTC | |
|
Re: DateTime days limit
by haukex (Archbishop) on Apr 20, 2020 at 22:25 UTC | |
|
Re: DateTime days limit
by mldvx4 (Hermit) on Apr 23, 2020 at 04:32 UTC |