Expand search and add operators.

This commit is contained in:
James Cole
2022-09-28 07:35:57 +02:00
parent 6eaed9829b
commit 9b7285ea84
7 changed files with 865 additions and 118 deletions

View File

@@ -33,7 +33,7 @@ use Log;
*/
class ParseDateString
{
private $keywords
private array $keywords
= [
'today',
'yesterday',
@@ -80,6 +80,7 @@ class ParseDateString
*/
public function parseDate(string $date): Carbon
{
Log::debug(sprintf('parseDate("%s")', $date));
$date = strtolower($date);
// parse keywords:
if (in_array($date, $this->keywords, true)) {
@@ -118,7 +119,7 @@ class ParseDateString
return new Carbon(sprintf('%d-01-01', $date));
}
throw new FireflyException(sprintf('[d]Not a recognised date format: "%s"', $date));
throw new FireflyException(sprintf('[d] Not a recognised date format: "%s"', $date));
}
/**