dates generator





    Generates dates between a range of dates.

    import datetime as dt
    from typing import Iterable, Tuple
    def next_date_generator(start: dt.datetime, end: dt.datetime, days_after: int = 1) -> Iterable[Tuple[dt.datetime, dt.datetime]]:
        """ Generates dates between start and end dates with the specified step.
        :param start: First date.
        :param end: Last date.
        :param days_after: Step between dates. Must be a positive integer.
        :returns: Generator with the next date.
        if days_after <= 0:
            raise ValueError('Value must be positive')
        while start <= end:
            yield start
            start = start + dt.timedelta(days_after)
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    • Security
    • Privacy Policy
    • Code Privacy
    • Terms of Service
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.