Can't understand where I went wrong in DateTime?

<?php
$currentDateTime = new DateTime("now", new DateTimeZone("Europe/Kiev"));

if(isWeekend($currentDateTime)){
 _e( "Message output", 'woocommerce' );
}else{
 if (isBeforeAM($currentDateTime)) {
 _e( "Message before lunch", 'woocommerce' );
}else{
 _e( "Message after lunch", 'woocommerce' );
}
}


function isWeekend($currentDateTime) {
 if (isFridayWeekend($currentDateTime)) {
 return true;
}
 return $currentDateTime--->format('N') >= 6;
}
isBeforeAM function($currentDateTime){
 $currentTimeStamp = $currentDateTime->getTimestamp();
 $timeStamp = strtotime(date('Y-m-d') . "13:00");
 return $currentTimeStamp < $timeStamp ;
}
isFridayWeekend function($currentDateTime){
 return $currentDateTime->format('N') == 5 && isBeforeAM($currentDateTime);
}

?>

Sending messages is not correct, it sends not what is going on weekdays
June 5th 19 at 21:24
1 answer
June 5th 19 at 21:26
isBeforeAM
The message after lunch
Before = BEFORE then
thanks, I just made a mistake when creating the question - Maximo commented on June 5th 19 at 21:29

Find more questions by tags PHPWooCommerceWordPress