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)

      Python language logo
      dates generator


      Generates dates between a range of dates.


        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.