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 } }
In reply to DateTime days limit by htmanning
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |