title: How to calculate the number of days between dates picked on a date picker calender
body: <p>I am trying to calculate the number of days between the dates selected on a date picker and use that value to calculate for the <b><code>totalPrice</code></b> value in the database.</p>
  
  <pre><code>db.define_table('invoice',
      Field('loaning_date', 'date', label=SPAN('Date Loaned', _style="font-weight: bold;"), requires=IS_NOT_EMPTY()),
      Field('returning_date', 'date', label=SPAN('Date Returned', _style="font-weight: bold;"), requires=IS_NOT_EMPTY()),
                                #Number of days calculation
      Field('daysLoaned', compute=lambda r: (r['returning_date']-r['loaning_date']).days),
      Field('price', 'float', label=SPAN('Price', _style="font-weight: bold;"), requires=IS_MATCH('[0-9]+', error_message=T('Enter Money in Proper Figures'))),
      Field('totalPrice', compute=lambda r: float(r['price'])* int(r['daysLoaned']), label=SPAN('Total Price', _style="font-weight: bold;")))
  
  </code></pre>
  
  <p>I expect this line below<br>
  <b><code>Field('daysLoaned', compute=lambda r: (r['returning_date']-r['loaning_date']).days)</code></b> <br />
  to give me an integer value depending on the selected dates. But instead i'm getting this error<br /> 
  <b><code>&lt;type 'exceptions.TypeError'&gt; unsupported operand type(s) for -: 'str' and 'str'</code></b><br />
  I don't know what I'm doing wrong where!</p>