How to use the fava.util.date.get_next_interval function in fava

To help you get started, we’ve selected a few fava examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github beancount / fava / tests / test_util_date.py View on Github external
def test_get_next_intervalfail2():
    with pytest.raises(NotImplementedError):
        get_next_interval(date(2016, 4, 18), "decade")
github beancount / fava / tests / test_util_date.py View on Github external
def test_get_next_interval(input_date_string, interval, expect):
    get = get_next_interval(_to_date(input_date_string), interval)
    assert get == _to_date(expect)
github beancount / fava / fava / api / __init__.py View on Github external
Returns:
            [
                (begin_date, end_date),
                ...
            ]
        """
        date_first, date_last = getters.get_min_max_dates(entries,
                                                          (Transaction))

        if not date_first:
            return []

        interval_tuples = []
        while date_first <= date_last:
            next_date = get_next_interval(date_first, interval)
            interval_tuples.append((date_first, next_date))
            date_first = next_date

        return interval_tuples