Repository: pallets-eco/croniter

Issue:
start_time not respected in get_next/get_prev/all_next/all_prev
The argument start_time does not have any effect with version 3.0.1

Code to reproduce
```
cron = croniter("* * * * * *")
cron.set_current(datetime(2024, 7, 12), force=True)
cron.get_next(datetime, start_time=datetime(2024, 7, 26))
````

Actual output
```
datetime(2024, 7, 12, 0, 0, 1)
```

Expected output
```
datetime(2024, 7, 26, 0, 0, 1)
```

Hints from issue comments:

Solution patch:
diff --git a/src/croniter/croniter.py b/src/croniter/croniter.py
index 8a01cf1..4f75398 100644
--- a/src/croniter/croniter.py
+++ b/src/croniter/croniter.py
@@ -235,10 +235,10 @@ class croniter(object):
     def get_next(self, ret_type=None, start_time=None, update_current=True):
         if start_time and self._expand_from_start_time:
             raise ValueError("start_time is not supported when using expand_from_start_time = True.")
-        return self._get_next(ret_type or self._ret_type, is_prev=False, update_current=update_current)
+        return self._get_next(ret_type or self._ret_type, start_time=start_time, is_prev=False, update_current=update_current)
 
     def get_prev(self, ret_type=None, start_time=None, update_current=True):
-        return self._get_next(ret_type or self._ret_type, is_prev=True, update_current=update_current)
+        return self._get_next(ret_type or self._ret_type, start_time=start_time, is_prev=True, update_current=update_current)
 
     def get_current(self, ret_type=None):
         ret_type = ret_type or self._ret_type
@@ -382,6 +382,7 @@ class croniter(object):
                 self._is_prev = False
                 yield self._get_next(ret_type or self._ret_type,
                                      start_time=start_time, update_current=update_current)
+                start_time = None
         except CroniterBadDateError:
             if self._max_years_btw_matches_explicitly_set:
                 return
@@ -395,6 +396,7 @@ class croniter(object):
                 self._is_prev = True
                 yield self._get_next(ret_type or self._ret_type,
                                      start_time=start_time, update_current=update_current)
+                start_time = None
         except CroniterBadDateError:
             if self._max_years_btw_matches_explicitly_set:
                 return


Test patch:
diff --git a/src/croniter/tests/test_croniter.py b/src/croniter/tests/test_croniter.py
index 7944c17..31391dc 100755
--- a/src/croniter/tests/test_croniter.py
+++ b/src/croniter/tests/test_croniter.py
@@ -1896,6 +1896,9 @@ class CroniterTest(base.TestCase):
              (datetime(2024, 7, 12, 0, 0, 3), datetime(2024, 7, 12, 0, 0, 3))]
         )
 
+        retns = (cron.get_next(datetime, start_time=datetime(2024, 7, 12)), cron.get_current(datetime))
+        self.assertEqual(retn[0], retns)
+
         cron.set_current(datetime(2024, 7, 12), force=True)
         retp = [(cron.get_prev(datetime), cron.get_current(datetime))
                 for a in range(3)]
@@ -1906,16 +1909,27 @@ class CroniterTest(base.TestCase):
              (datetime(2024, 7, 11, 23, 59, 57), datetime(2024, 7, 11, 23, 59, 57))]
         )
 
+        retps = (cron.get_prev(datetime, start_time=datetime(2024, 7, 12)), cron.get_current(datetime))
+        self.assertEqual(retp[0], retps)
+
         cron.set_current(datetime(2024, 7, 12), force=True)
         r = cron.all_next(datetime)
         retan = [(next(r), cron.get_current(datetime)) for a in range(3)]
 
+        r = cron.all_next(datetime, start_time=datetime(2024, 7, 12))
+        retans = [(next(r), cron.get_current(datetime)) for a in range(3)]
+
         cron.set_current(datetime(2024, 7, 12), force=True)
         r = cron.all_prev(datetime)
         retap = [(next(r), cron.get_current(datetime)) for a in range(3)]
 
+        r = cron.all_prev(datetime, start_time=datetime(2024, 7, 12))
+        retaps = [(next(r), cron.get_current(datetime)) for a in range(3)]
+
         self.assertEqual(retp, retap)
+        self.assertEqual(retp, retaps)
         self.assertEqual(retn, retan)
+        self.assertEqual(retn, retans)
 
         cron.set_current(datetime(2024, 7, 12), force=True)
         uretn = [(cron.get_next(datetime, update_current=False), cron.get_current(datetime))