Last active
January 11, 2017 14:04
-
-
Save mattpramschufer/4bc0a1f835205e89632d1bff6ddc211a to your computer and use it in GitHub Desktop.
Figures out if the current time is during our black out period which we do not want to text users
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
<?php | |
/** | |
* Figures out if the current time is during our black out period which we do not want to text users | |
* | |
* @return bool | |
*/ | |
static public function isDuringBlackOutTime() { | |
$currentTime = Carbon::now(); | |
if($currentTime->format('A') == 'AM'){ | |
$startBlackout = Carbon::parse('9pm')->subDay(1); | |
$endBlackout = Carbon::parse('8am'); | |
} else { | |
$startBlackout = Carbon::parse('9pm'); | |
$endBlackout = Carbon::parse('8am')->addDay(1); | |
} | |
return $currentTime->between($startBlackout, $endBlackout); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment