diff --git a/src/XeroPHP/Remote/Query.php b/src/XeroPHP/Remote/Query.php index 635fa291..28c79bbf 100644 --- a/src/XeroPHP/Remote/Query.php +++ b/src/XeroPHP/Remote/Query.php @@ -3,6 +3,7 @@ namespace XeroPHP\Remote; use DateTime; +use DateTimeInterface; use XeroPHP\Application; class Query @@ -211,6 +212,17 @@ public function date(DateTime $date) return $this; } + /** + * @param DateTimeInterface $date + * @param string $operator the date comparison operator, e.g. >, >=, etc + * @param string $parameter + * @return $this + */ + public function whereDate(DateTimeInterface $date, $operator = '==', $parameter = 'Date') + { + return $this->addWhere('AND', [sprintf("$parameter $operator DateTime(%s)", $date->format('Y, m, d'))]); + } + /** * @param int $page * diff --git a/tests/Application/ApplicationTest.php b/tests/Application/ApplicationTest.php index e74aab41..38457351 100644 --- a/tests/Application/ApplicationTest.php +++ b/tests/Application/ApplicationTest.php @@ -1,6 +1,6 @@