Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > Wrapper libraries >

Filter By Date Range using xero.php

Started by Paul Langard -   in Wrapper libraries

I'm trying to return all Invoices for June 2013, NOT just those that have been changed since a certain date.

I can see how the API documentation handles this situation, it says to use the following value for the where parameter (from http://developer.xero.com/api-overview/http-requests-and-responses/#get-filtered):
FullyPaidOnDate >= DateTime(2011, 10, 01) AND FullyPaidOnDate <= DateTime(2011, 10, 30)

However I'd like to use the useful xero.php wrapper if possible.
After reading the github page and various discussions on here as well as the code, it looks to me as if the filter I should be setting is as follows (ie the 'value' of the array item is itself an array made up of operand, literal value):

$aFilter = array(
'Date' => array('>=','DateTime(2013, 06, 01)')
,'Date' => array('<=','DateTime(2013, 06, 30)')

$result = $xero->Invoices('','',$aFilter,'');

However this results in the following error:

[ErrorNumber] => 16
[Type] => QueryParseException
[Message] => Operator '<=' incompatible with operand types 'DateTime?' and 'String'

Also of course as the field name is the array key, I only end up with one array item not two as you can see in the array dump:

[Date] => Array
[0] => <=
[1] => DateTime(2013,06,30)


Any help that you can offer would be appreciated.