title: Invoice::setDueDate() must implement interface DateTimeInterface, Xero API using calcinai
body: <p>I am following this <a href="https://github.com/calcinai/xero-php" rel="noreferrer">wrapper</a></p>
  
  <p>I have this error: <strong>Catchable fatal error: Argument 1 passed to XeroPHP\Models\Accounting\Invoice::setDueDate() must implement interface DateTimeInterface, string given</strong></p>
  
  <p>This is my code:</p>
  
  <pre><code>try{
              $lineitem = new LineItem($this-&gt;_xi);
              $lineitem-&gt;setAccountCode('200')
              -&gt;setQuantity('5.400')
              -&gt;setDescription('this is awesome test')
              -&gt;setUnitAmount('9900.00');
  
              $contact = new Contact($this-&gt;_xi);
              $contact-&gt;setName("John Doe")
                  -&gt;setFirstName("John")
                  -&gt;setLastName("Doe")
                  -&gt;setEmailAddress("johngwapo@hot.com")
                  -&gt;setContactStatus(Contact::CONTACT_STATUS_ACTIVE);
  
  
  
              $invoice = new Invoice($this-&gt;_xi);
              $invoice-&gt;setType(Invoice::INVOICE_TYPE_ACCREC)
                  -&gt;setStatus(Invoice::INVOICE_STATUS_AUTHORISED)
                  -&gt;setContact($contact)
                  //-&gt;setDate(\DateTimeInterface::format("Y-m-d"))
                  -&gt;setDueDate("2018-09-09")
                  -&gt;setLineAmountType(Invoice::LINEAMOUNT_TYPE_EXCLUSIVE)
                  -&gt;addLineItem($lineitem)
                  -&gt;setInvoiceNumber('10')
                  -&gt;save();
  
  
  
          }catch ( Exception $e ){
              $GLOBALS['log']-&gt;fatal('[Xero-createContact]-' . $e-&gt;getMessage());
              echo $e-&gt;getMessage();
  
          }
  </code></pre>
  
  <p>When I tried doing it like this:</p>
  
  <pre><code>-&gt;setDueDate(\DateTimeInterface::format("Y-m-d"))
  </code></pre>
  
  <p>I got this error instead: <strong>Fatal error: Non-static method DateTimeInterface::format() cannot be called statically, assuming $this from incompatible context</strong></p>
  
  <p>This is the function of setDueDate that I am calling:</p>
  
  <pre><code> /**
       * @param \DateTimeInterface $value
       * @return Invoice
       */
  public function setDueDate(\DateTimeInterface $value)
      {
          $this-&gt;propertyUpdated('DueDate', $value);
          $this-&gt;_data['DueDate'] = $value;
          return $this;
      }
  </code></pre>
  
  <p>I'm really lost here as to how do I use this DateTimeInterface and how can I even set a future date using it, and how do I solve all this errors.</p>