tehmaze/natural — pull request #6 by davidjb (2014-09-09 05:38:00+00:00)
Title: Ensure yesterday and tomorrow are determined by absolute date comparison

When the delta between two datetime objects is calculated, the notion of yesterday and tomorrow were applied incorrectly. Specifically, 'tomorrow' and 'yesterday' are calculated on the number of seconds between the datetime objects, rather than on the difference in dates themselves. This is best illustrated with an example:
```python
>>> from natural.date import duration
>>> from datetime import datetime
>>> duration(t=datetime(2014,9,7,11), now=datetime(2014,9,9,10))
u'yesterday' # term should only apply to 2014-08-08
>>> duration(t=datetime(2014,9,7,11), now=datetime(2014,9,5,12))
u'tomorrow' # term should only apply to 2014-08-06
>>> duration(t=datetime(2014,9,7,10), now=datetime(2014,9,9,10))
u'2 days ago' # okay as >= 2 days ago
```

So in the first instance, because the datetimes are 1 day 23 hours apart (< 2 days worth of seconds), the result is ``'yesterday'``, and the second example shows the same for ``'tomorrow'``.
[This line](https://github.com/tehmaze/natural/blob/master/natural/date.py#L216) of date.py is the cause in this instance, as it considers the number of seconds rather than the difference in dates.

I think the (only?) way to solve this issue is to take the difference between just the date components of the two datetime objects, and check their difference. This is what I've done in the given pull request. Otherwise, there's no way to know when/if a given difference of seconds crosses a given date boundary.