Last active
September 21, 2018 10:44
-
-
Save reindert-vetter/da4e646ac89fe9419da7e969363a423c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const WEEKDAY_MONDAY = 1; | |
/** | |
* Get drop off date | |
* | |
* @param int $dateTime | |
* @return int | |
*/ | |
public function getDropOffDateTimeFromDeliveryDateTime($dateTime) | |
{ | |
$weekDay = date('N', $dateTime); | |
if ($weekDay === self::WEEKDAY_MONDAY) { | |
return strtotime("-2 day", $dateTime); | |
} | |
return strtotime("-1 day", $dateTime); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Make sure the day is in the future: