Correct empty timestamp check in createDateTimeFromTimestamp
createDateTimeFromTimestamp interpreted 0 as timestamp as a mistake while 0 is a valid timestamp. The fix checks if timestamp is null (not defined/initialized), so that 0 is treated as a correct timestamp.
This commit is contained in:
parent
a87c010c77
commit
9ac7758e87
@ -98,7 +98,7 @@ class EpisodeActionController extends Controller {
|
|||||||
* @return DateTime
|
* @return DateTime
|
||||||
*/
|
*/
|
||||||
private function createDateTimeFromTimestamp(?int $since): DateTime {
|
private function createDateTimeFromTimestamp(?int $since): DateTime {
|
||||||
return ($since)
|
return ($since !== null)
|
||||||
? (new \DateTime)->setTimestamp($since)
|
? (new \DateTime)->setTimestamp($since)
|
||||||
: (new \DateTime('-1 week'));
|
: (new \DateTime('-1 week'));
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ class SubscriptionChangeController extends Controller {
|
|||||||
* @return DateTime
|
* @return DateTime
|
||||||
*/
|
*/
|
||||||
private function createDateTimeFromTimestamp(?int $since): DateTime {
|
private function createDateTimeFromTimestamp(?int $since): DateTime {
|
||||||
return ($since)
|
return ($since !== null)
|
||||||
? (new \DateTime)->setTimestamp($since)
|
? (new \DateTime)->setTimestamp($since)
|
||||||
: (new \DateTime('-1 week'));
|
: (new \DateTime('-1 week'));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user