Handle daterange-filter-strings that cannot be parsed successfully
When the user enters a daterange-filter-string that cannot be parsed successfully an error-message (or something like that) should be shown.
- [ ] Correct handling in `api.py`
- [ ] UI changes

diff --git a/beancount_web/api.py b/beancount_web/api.py
index 8e3cd2c0..e1539249 100644
--- a/beancount_web/api.py
+++ b/beancount_web/api.py
@@ -297,19 +297,13 @@ class BeancountReportAPI(object):
                 'account': real_account.account,
                 'balances_children': self._table_totals(real_account),
                 'balances': {},
-                'is_leaf': (len(list(realization.iter_children(real_account))) == 1), # True if the accoutn has no children or has entries
+                'is_leaf': len(real_account) == 0 or real_account.txn_postings,
                 'postings_count': len(real_account.txn_postings)
             }
 
             for pos in real_account.balance.cost():
                 line['balances'][pos.lot.currency] = pos.number
 
-            # Accounts that are not leafs but have entries are leafs as well
-            for currency in self.options['commodities']:
-                if currency in line['balances'] and currency in line['balances_children']:
-                    if line['balances'][currency] != line['balances_children'][currency]:
-                        line['is_leaf'] = True
-
             lines.append(line)
 
         return lines
@@ -477,11 +471,11 @@ class BeancountReportAPI(object):
             ]
         """
 
-        if len(entries) == 0:
-            return []
-
         date_first, date_last = getters.get_min_max_dates(entries, (Transaction))
 
+        if not date_first:
+            return []
+
         def get_next_month(date_):
             month = (date_.month % 12) + 1
             year = date_.year + (date_.month + 1 > 12)
diff --git a/beancount_web/templates/_layout.html b/beancount_web/templates/_layout.html
index df203dc6..53f27b2e 100644
--- a/beancount_web/templates/_layout.html
+++ b/beancount_web/templates/_layout.html
@@ -58,7 +58,7 @@
                             <input type="search" class="search-direct-apply" data-url="{{ request.path }}?filter_time=">
                         </div>
                         <ul>
-                            {% set time_search_strings = ['this month', '2015-03', 'march 2015', 'mar 2015', 'last year', 'october this year', 'aug last year'] %}
+                            {% set time_search_strings = ['this month', '2015-03', 'march 2015', 'mar 2015', 'last year', 'aug last year', '2010-10 - 2014'] %}
                             <li class="info">Supports search strings like
                                 {% for suggestion in time_search_strings %}
                                     <a href="{{ request.path }}?filter_time={% if suggestion != entry_filters['time'] %}{{ suggestion }}{% endif %}" data-filter="{{ suggestion }}">{{ suggestion }}</a>{% if not loop.last %}, {% endif %}
diff --git a/beancount_web/util/dateparser.py b/beancount_web/util/dateparser.py
index 21cde18e..5d790b56 100644
--- a/beancount_web/util/dateparser.py
+++ b/beancount_web/util/dateparser.py
@@ -49,7 +49,7 @@ def daterange(year=None, month=None, day=None, timedelta=datetime.timedelta()):
         end = datetime.date(year + 1, 1, 1)
     elif (not day) and month:
         start = datetime.date(year, month, 1)
-        end = datetime.date(year, month + 1, 1)
+        end = datetime.date(year + (month > 11), (month % 12) + 1, 1)
     else:  # ~= if (year and month and day)
         start = end = datetime.date(year, month, day)
     return start, end
@@ -130,6 +130,9 @@ if __name__ == '__main__':
         '2000-01-03': daterange(2000, 1, 3),
         'this year': daterange(today.year),
         'august next year': daterange(today.year + 1, 8),
+        'this month': daterange(today.year, today.month),
+        'this december': daterange(today.year, 12),
+        'this november': daterange(today.year, 11),
         '2nd aug, 2010': daterange(2010, 8, 2),
         'august 3rd, 2012': daterange(2012, 8, 3),
         '2014 to 2015': (daterange(2014)[0], daterange(2015)[1]),
['beancount_web/util/dateparser.py', 'beancount_web/api.py', 'beancount_web/templates/_layout.html']