fix yesterday test now

This commit is contained in:
nasser committed 2022-02-16 13:38:40 +03:30
1 parent 3de8155088
commit 40e00c1fa2
2 files changed
+6 -5

No files matched your search

+5 -4
View File
@@ -18,6 +18,7 @@ trait Creator
*/
public function __construct($datetime = null, $timezone = null)
{
$dt = $datetime;
if (static::$testNow) {
$dt = static::$testNow;
} elseif (empty($datetime)) {
@@ -59,7 +60,7 @@ trait Creator
*/
public static function today($timezone = null)
{
return (new static($timezone))->startDay();
return (new static(null, $timezone))->startDay();
}
/**
@@ -71,7 +72,7 @@ trait Creator
*/
public static function tomorrow($timezone = null)
{
return (new static('+1 day', $timezone))->startDay();
return (new static(null, $timezone))->addDay()->startDay();
}
/**
@@ -83,14 +84,14 @@ trait Creator
*/
public static function yesterday($timezone = null)
{
return (new static('-1 day', $timezone))->startDay();
return (new static(null, $timezone))->subDay()->startDay();
}
/**
* Create a Verta instance from a DateTime one
*
* @param $datetime [optional]
* @param bool $timezone [optional]
* @param \DateTimeZone|string|null $timezone [optional]
*
* @return static
*/